Commit 099c573f by BellCodeEditor

save project

parent 7e3a2ff3
Showing with 56 additions and 1 deletions
def new_input():
total = []
while True:
unit = input('请输入(q退出):')
if unit == 'q':
break
else:
try:
unit = int(unit)
except:
print("请重新输入一个数字")
else:
total.append(unit)
finally:
print("=====================")
return total
def new_input():
total = []
while True:
unit = input('请输入(q退出):')
if unit == 'q':
break
else:
try:
unit = int(unit)
except:
print("请重新输入一个数字")
else:
total.append(unit)
finally:
print("=====================")
return total
\ No newline at end of file
a = open(r"C:\Users\8hao\Desktop\新建文件夹\1234567890.txt","w",encoding="utf-8")
a.write("大傻子")
a.close()
a = open(r"C:\Users\8hao\Desktop\新建文件夹\1234567890.txt","a",encoding="utf-8")
a.write("李某翰是大傻子")
a.close()
\ No newline at end of file
# 写入同学们的捐赠明细:'小兰:12本'、'小丽:11本'、'李文:9本'、'张伟:16本' with open(r"C:\Users\8hao\Desktop\新建文件夹\1234567890.txt",'r',encoding='utf-8')as filt1:
a=filt1.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