Commit 6969ca49 by BellCodeEditor

save project

parent a2c7604c
Showing with 7 additions and 3 deletions
new_data=''
with open(r'C:\Users\WIN10\Documents\新建文本文档.txt','r',encoding='utf-8')as file:
for data in file:
if '1' in data:
print('1在文件中')
if '20' in data:
print('20在文件中')
\ No newline at end of file
a=data.replace('0','10')
new_data += a
print(new_data)
with open(r'C:\Users\WIN10\Documents\新建文本文档.txt','w',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