Commit 82960ddc by BellCodeEditor

save project

parent fd138522
Showing with 10 additions and 3 deletions
......@@ -4,5 +4,12 @@
# file1.close()
# flie1.write("小兰:12本小丽:11本李文:9本张伟:16本")
with open(r'C:\Users\Administrator\Desktop\book.txt','a',encoding='utf-8') as file1:
file1.write("小兰:12本\n小丽:11本\n李文:9本\n张伟:16本")
\ No newline at end of file
# with open(r'C:\Users\Administrator\Desktop\book.txt','a',encoding='utf-8') as file1:
# file1.write("小兰:12本\n小丽:11本\n李文:9本\n张伟:16本")
with open(r'C:\Users\Administrator\Desktop\book.txt','r',encoding='utf-8') as file1:
# a=file1.read()
# print(a)
for data in file1:
if '小强:10本' in data:
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