Commit 0e874391 by BellCodeEditor

save project

parent 35cff45c
Showing with 12 additions and 4 deletions
new_data=''
with open(r'C:\Users\no3\Desktop\book.txt','r',encoding='utf-8') as file1:
for data in file1:
if '12345' in data:
data.replace('12345','12321')
new_data += data
with open(r'C:\Users\no3\Desktop\book.txt','w',encoding='utf-8') as file1:
file1.write(new_data)
with open(r'C:\Users\no3\Desktop\book.txt','w',encoding='utf-8') as file
for date in file:
if '123321' in date:
print("文件中有")
with open(r'C:\Users\no3\Desktop\book.txt','r',encoding='utf-8') as file1:
a=file1.read()
print(a)
\ 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