Commit 739d5496 by BellCodeEditor

save project

parent 36f4e980
n = 0
n = int(input("请输入"))
a=open(r"C:\Users\XMBC\Desktop\a.txt","w",encoding="utf-8")
\ No newline at end of file
a=open(r"C:\Users\XMBC\Desktop\a.txt","w",encoding="utf-8")
a.write("小强:10本\n")
a.write("李明:15本\n")
a.close()
with open(r"C:\Users\XMBC\Desktop\a.txt","a",encoding="utf-8") as a:
a.write("小兰:12本\n")
with open(r"C:\Users\XMBC\Desktop\a.txt","r",encoding="utf-8") as a:
for b in a:
if "李明:15本" in a:
print("找到了")
for b in a:
if "小强:10本" in a:
print("找到了")
\ No newline at end of file
import func
a=func.new_input()
print(a)
\ No newline at end of file
def new_input():
total = []
while True:
unit= input("请输入:")
if unit== 'q':
break
try:
unit= int(unit)
except:
print("类型错误")
else:
total.append(unit)
return total
def sum(a):
s=0
for i in a:
s+=i
return s
a=new_input()
print(a)
\ 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