Commit c3a28780 by BellCodeEditor

save project

parent 9f9b20cb
Showing with 7 additions and 9 deletions
#with open(r"C:\Users\Windows 10\Desktop\text.txt","a",encoding="utf-8") as fileq:
#fileq.write("小兰:12本\n")
#fileq.write("小红:12本\n")
#fileq.write("小包:12本\n")
#fileq.write("小梅:12本\n")
fileq=open(r"C:\Users\Windows 10\Desktop\text.txt","r","encoding=utf-8")
a=fileq.read()
fileq.close()
\ No newline at end of file
with open(r"C:\Users\Windows 10\Desktop\text.txt","r",encoding="utf-8") as fileq:
for data in fileq:
if "小强:10本"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