Commit e1ef00fd by BellCodeEditor

save project

parent cf68cd5b
Showing with 4 additions and 3 deletions
...@@ -6,5 +6,6 @@ fuck1.close() ...@@ -6,5 +6,6 @@ fuck1.close()
# file.write("\n小兰:12本\n""小丽:11本\n""李文:9本\n""张伟:16本") # file.write("\n小兰:12本\n""小丽:11本\n""李文:9本\n""张伟:16本")
with open(r"C:\Users\admin\Desktop\book.txt",'r',encoding="utf-8")as file: with open(r"C:\Users\admin\Desktop\book.txt",'r',encoding="utf-8")as file:
for data in file: for data in file:
if'小兰:12本'in data: if '小兰:12本' in data:
print("小兰在里面") data=data.replace("小兰:12本","小兰:14本")
\ No newline at end of file new_data += 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