python笔记--在文件进行输出

将print的内容输出到文件中

1 #将数据输出到文件中
2 fp=open('E:/text1.txt','a+')
3 print('hello word',file=fp)
4 fp.close()

 

 

1 #不进行换行输出(在一行输出)
2 print('hello','daitu')

 

posted @ 2023-02-25 16:27  阿飞藏泪  阅读(99)  评论(0编辑  收藏  举报
1 2 3
4