Commit 878c1f70 by BellCodeEditor

save project

parent fd4eabc3
Showing with 13 additions and 0 deletions
......@@ -7,6 +7,19 @@
# n.close()
# with open(r"C:\Users\Administrator\Desktop\test.txt",'r',encoding='utf-8') as n:
# a = n.read()
# print(a)
new_data=''
with open(r"C:\Users\Administrator\Desktop\test.txt",'r',encoding='utf-8') as n:
for data in n:
if '张三:100本' in data:
data=data.replace('张三:100本','张三:10本')
print('ihfpp')
new_data+=data
with open(r"C:\Users\Administrator\Desktop\test.txt",'w',encoding='utf-8') as n:
n.write(new_data)
with open(r"C:\Users\Administrator\Desktop\test.txt",'r',encoding='utf-8') as n:
a = n.read()
print(a)
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