Commit ba01a84b by BellCodeEditor

auto save

parent 0efa57bd
Showing with 23 additions and 5 deletions
s= open(r'C:\Users\Administrator\Desktop\test.txt','w',encoding='utf-8')
s.write('s:11本\n')
s.write('w:11本\n')
s.write('b:11本\n')
s.close()
\ No newline at end of file
s.write('傻炮:11本\n')
s.write('刁毛:11本\n')
s.write('靓仔:11本\n')
s.close()
new_data=''
with open(r'C:\Users\Administrator\Desktop\test.txt','a',encoding='utf-8')as s:
s.write('大:11本\n')
with open(r'C:\Users\Administrator\Desktop\test.txt','r',encoding='utf-8')as s:
for data in s:
if '大:11本'in data:
data=data.replace('靓仔:11本','靓仔:21本')
new_data +=data
with open(r'C:\Users\Administrator\Desktop\test.txt','w',encoding='utf-8')as s:
s.write(new_data)
with open(r'C:\Users\Administrator\Desktop\test.txt','r',encoding='utf-8')as s:
a=s.read()
print(a)
\ No newline at end of file
with open(r'C:\Users\Administrator\Desktop\test.txt','a',encoding='utf-8')as s:
s.write('大:11本\n')
\ 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