Commit 5079a140 by BellCodeEditor

save project

parent f10f6843
Showing with 7 additions and 3 deletions
new_data= ''
with open(r"C:\Users\MC3-07\Desktop\test.txt", "r", encoding="utf-8") as file:
for data in file:
if '小兰:12本' in data:
print("有")
else:
print(data)
data=data.replace("小兰:12本","小兰:11本")
new_data+=data
print(new_data,data)
with open(r"C:\Users\MC3-07\Desktop\test.txt", "w", encoding="utf-8") as file2:
file2.write(new_data)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment