Commit e2a420f7 by BellCodeEditor

save project

parent 3e5eba2a
Showing with 10 additions and 2 deletions
newdate=''
with open('C:\\Users\\john\\Desktop\\tv.txt','r',encoding='utf-8') as file1: with open('C:\\Users\\john\\Desktop\\tv.txt','r',encoding='utf-8') as file1:
for date in file1: for date in file1:
if '张伟:16' in date: if '小兰:12' in date:
print('张伟在文件中。') date=date.replace('小兰:12','小兰,19')
newdate+=date
with open('C:\\Users\\john\\Desktop\\tv.txt','w',encoding='utf-8') as file1:
print(newdate)
#file1.write(newdate)
\ 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