Commit e4bdb2ab by BellCodeEditor

save project

parent 2651d3f2
Showing with 11 additions and 2 deletions
......@@ -7,4 +7,13 @@
# file1.write("张伟:16\n")
with open(r'C:\Users\makcoo\Desktop\text.txt','a',encoding='utf-8')as file1:
file1.write("小强:12\n")
file1.write("李明:15\n")
\ No newline at end of file
file1.write("李明:15\n")
with open(r'C:\Users\makcoo\Desktop\text.txt','r',encoding='utf-8')as file1:
a = file1.read()
for data in a:
print(data)
if data == "小强:12\n":
print(data)
data.replace("小强:12\n"("李明:15\n"))
with open(r'C:\Users\makcoo\Desktop\text.txt','r',encoding='utf-8')as file1:
file1.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