Commit 2499e97c by BellCodeEditor

save project

parent fbaac1e6
Showing with 11 additions and 4 deletions
...@@ -7,6 +7,14 @@ ...@@ -7,6 +7,14 @@
# wsc.write('张伟:16本\n') # wsc.write('张伟:16本\n')
# wsc.close() # wsc.close()
with open(r'C:\Users\1\Desktop\吴思辰.txt','a',encoding='utf-8') as wsc: # with open(r'C:\Users\1\Desktop\吴思辰.txt','a',encoding='utf-8') as wsc:
wsc.write('小强:12本\n') # wsc.write('小强:12本\n')
wsc.write('李明:15本\n') # wsc.write('李明:15本\n')
\ No newline at end of file with open(r'C:\Users\1\Desktop\吴思辰.txt','r',encoding='utf-8') as wsc:
for i in wsc:
if '小强:10本' in i:
print('小强数据在文件中')
if '小兰:12本' in i:
print('小兰数据在文件中')
# a=wsc.read()
# print(a)
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