Commit 141a044f by BellCodeEditor

save project

parent c34b5995
Showing with 16 additions and 5 deletions
......@@ -7,9 +7,21 @@
# with open (r"C:\Users\周\Desktop\123.txt","a",encoding='UTF-8') as aaa:
# aaa.write("小强:12\n")
# aaa.write("李明:15\n")
# with open(r"C:\Users\周\Desktop\123.txt","r",encoding='UTF-8') as bbb:
# for q in bbb:
# if "小强:10" and "xiaox" in bbb:
# print("在其中")
# else:
# print("不在")
aaa=""
with open(r"C:\Users\周\Desktop\123.txt","r",encoding='UTF-8') as bbb:
for q in bbb:
if "小强:10" and "xiaox" in bbb:
print("在其中")
else:
print("不在")
\ No newline at end of file
if "小强:10" in q:
q=q.replace("小强:10","小强:11")
if "小兰:12" in q:
q=q.replace("小兰:12","小兰:14")
aaa+=q
with open(r"C:\Users\周\Desktop\123.txt","w",encoding='UTF-8') as bbb:
bbb.write(aaa)
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