2019-03-31
阅读量:
626
从键盘输入一些字符,逐个把它们写到磁盘文件上
'''
def tm097():
'''
with .. as ..打开会自动关闭。
其他方式打开,别忘了通过代码关闭。
'''
path = 'd:/test.txt'
with open(path,'w+') as f:f.write('')
while 1:
c = input()
if c=='#':
break
else:
with open(path,'a+') as f:f.write(c)






评论(0)


暂无数据
推荐帖子
2条评论
6条评论
7条评论