Commit 8605a0de by BellCodeEditor

save project

parent f3bee832
Showing with 4 additions and 4 deletions
......@@ -4,7 +4,7 @@
##file=open(r"C:\Users\paulb\Desktop\test.txt",'a',encoding='utf-8')
##file.write('小强:12\n小张:18\n小二:13\n')
##file.close()
with open(r"C:\Users\paulb\Desktop\test.txt",'w',encoding='utf-8'):
with open(r"C:\Users\paulb\Desktop\test.txt",'r',encoding='utf-8'):
for data in file:
if "小强:12" and "小二:13" in data:
print("找到了")
\ No newline at end of file
if "小强:12" in data:
data=data.replace('小强:12','小强15')
\ 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