Commit 710ca6f2 by BellCodeEditor

save project

parent 8cc26688
Showing with 9 additions and 6 deletions
#with open(r'C:\Users\Administrator\Desktop\kun.txt','a',encoding='utf-8') as file: #with open(r'C:\Users\Administrator\Desktop\kun.txt','a',encoding='utf-8') as file:
#file.write("\n小强:12本、\n李明:15本、") #file.write("\n蔡徐坤")
with open(r'C:\Users\Administrator\Desktop\kun.txt','r',encoding='utf-8') as file: with open(r'C:\Users\Administrator\Desktop\kun.txt','r',encoding='utf-8') as file:
for i in file: for i in file:
if "两年半" in i: if "蔡徐坤" in i:
print("坤坤找到了") i = i.replace('蔡徐坤','唱、跳、rap、篮球')
else: #print("坤坤找到了")
print("没找到坤坤") #else:
\ No newline at end of file #print("没找到坤坤")
with open(r'C:\Users\Administrator\Desktop\kun.txt','w',encoding='utf-8') as file1:
file1.write(new_data)
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