文件写入内容

"""
从键盘输入一些字符,逐个把它们写到磁盘文件上,直到输入一个 # 为止
"""
while True:
try:
s=input()
with open("./5.txt",'a') as f:
if s!='#':
f.write(s)
else:break
except:break
posted @ 2021-12-14 10:48  Brynaaa_111  阅读(59)  评论(0)    收藏  举报