Commit fc4dffa0 by BellCodeEditor

save project

parent 6c253015
Showing with 17 additions and 13 deletions
import circle new_data=''
\ No newline at end of file with open(r'C:\Users\Administrator\Desktop\book.txt','r',encoding='utf-8') as file:
for date in file:
if '123456' in date:
data = date.replace('123456','123456654321')
new_data += data
with open(r'C:\Users\Administrator\Desktop\book.txt','w',encoding='utf-8') as file:
file1.write(new_data)
with open(r'C:\Users\Administrator\Desktop\book.txt','r',encoding='utf-8') as file:
a=file1.read()
print(a)
\ No newline at end of file
# 写入同学们的捐赠明细:'小兰:12本'、'小丽:11本'、'李文:9本'、'张伟:16本' with open(r'C:\Users\Administrator\Desktop\book.txt','r',encoding='utf-8') as file:
file1=open(r'C:\Users\Administrator\Documents\book.txt','w',encoding='utf-8') for date in file:
file1.write('asdfghjkl') if '123456' in date:
file1.write('asdfghrtetybl') print('文件存在')
file1.close() \ No newline at end of file
with open('C:\Users\Administrator\Desktop\book1.txt','a',encoding='utf-8')
file.write('asdfghjkl')
file.write('asdfghrtetybl')
\ 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