Commit a5689430 by BellCodeEditor

save project

parent f1001880
Showing with 16 additions and 0 deletions
file = open(r"C:\yyy\qwertyuiop.txt","w",encoding="utf-8")
file.write("小强:10本\n")
file.close()
new_file=""
with open(r"C:\yyy\qwertyuiop.txt","r",encoding="utf-8") as file:
for line in file:
if "小强:10本" in line:
line = line.replace("小强:10本","小强:11本")
new_file +=line
with open(r"C:\yyy\qwertyuiop.txt","w",encoding="utf-8") as file:
file.write(new_file)
\ 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