Commit be34d0b8 by BellCodeEditor

save project

parent 027108f0
Showing with 6 additions and 13 deletions
悟空 12 15 11 12 11 12 14 13 15 17
小贝 11 14 17 14 19 10 17 16 15 14
诺依 12 17 15 14 13 19 18 11 11 10
new_data='' file=open(r"C:\Users\no3\Documents\lesson12-1\sales_list.txt",'r',encoding='utf-8')
with open(r'C:\Users\no3\Desktop\book.txt','r',encoding='utf-8') as file1: with open(r"C:\Users\no3\Documents\lesson12-1\sales_list.txt",'r',encoding='utf-8')as file:
for data in file1: \ No newline at end of file
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','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