Commit 085fd23b by BellCodeEditor

save project

parent 40403fb2
Showing with 21 additions and 2 deletions
...@@ -7,5 +7,10 @@ fill.write("张伟:16本\n") ...@@ -7,5 +7,10 @@ fill.write("张伟:16本\n")
fill.close() fill.close()
with open('C:\\Users\\yu\\Desktop\\编程\\tt.txt','a',encoding='gb2312') as fill: #with open('C:\\Users\\yu\\Desktop\\编程\\tt.txt','a',encoding='gb2312') as fill:
fill.write("小红:999999本\n") #fill.write("小红:999999本\n")
with open('C:\\Users\\yu\Desktop\\编程\\tt.txt','r',encoding='gb2312') as fill:
a=fill.read()
for i in a:
if '小兰:12本' in i:
\ No newline at end of file
# w=open("C:\\Users\\yu\\Desktop\\test.tst","w",encoding="gb2312")
# w.write("小强:10 ")
# w.write("小丽:12")
# w.close()
with open("C:\\Users\\yu\\Desktop\\test.tst","r",encoding="gb2312") as w:
for data in w:
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