Commit 634088e2 by BellCodeEditor

save project

parent 9e7c8c4b
Showing with 13 additions and 0 deletions
a=open("C:\\Users\\EDY\\Desktop\\text.txt","w",encoding="utf-8")
a.write("小强:12")
a.close()
b=""
with open("C:\\Users\\EDY\\Desktop\\text.txt","r",encoding="utf-8") as a:
for data in a:
if"小强:12"in data:
b=data.replace("小强:12","小强:13")
b+=data
with open("C:\\Users\\EDY\\Desktop\\text.txt","w",encoding="utf-8") as a:
a.write(b)
print(b)
\ 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