Commit 5ac5ecf4 by BellCodeEditor

save project

parent 208e9334
Showing with 13 additions and 4 deletions
......@@ -2,13 +2,21 @@
# file=open(r"C:\Users\EDZ\Desktop\et.txt","w",encoding="utf-8")
# file.write('小兰:12本\n小丽:11本\n李文:9本\n张伟:16本\n')
# file.close()
#with open(r"C:\Users\EDZ\Desktop\et.txt","a",encoding="utf-8")as file:
# file.write('小没:22本\n')
new_data=" "
with open(r"C:\Users\EDZ\Desktop\et.txt","r",encoding="utf-8")as file:
data=file.read()
if "小没:22本" in data:
print("在")
else:
print("不在")
if "小没" in data:
data=data.replace("小没","小陈")
new_data+=data
with open(r"C:\Users\EDZ\Desktop\et.txt","w",encoding="utf-8")as file:
file.write(new_data)
#if "小没:22本" in data:
# print("在")
#else:
# print("不在")
\ 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