热线电话:13121318867

登录
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)
22.0798
4
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子