返回顶部

收藏

Open a text file and write a line of text

更多
myfile = open('myfile', 'w')             # open for output (creates)

myfile.write('hello text file\n')        # write a line of text

myfile.close()

标签:Python,File

收藏

0人收藏

支持

0

反对

0

»更多 您可能感兴趣的代码
  1. 2016-11-27 14:14:10File readline() by 张宋付
  2. 2015-02-23 09:40:23ubuntu安装python3的python-pip by 甄码农
  3. 2013-06-04 13:43:27web.py中自定义jinja2模块 by 赵小全
  4. 2015-11-27 20:36:13Iterating Over Lines with readlines by 张宋付
  5. 2016-01-04 17:35:46Closing Files by 西国の海妖
  6. 2016-08-19 15:46:08Working with Directories by 西国の海妖
  7. 2016-09-03 11:47:53Define function to Open a file by 阮小七
  8. 2016-09-19 19:25:12File Output by jack.chen
  9. 2016-10-19 10:47:50Handling I/O Errors by 大猪
  10. 2016-12-06 09:03:52Demonstrates writing to a text file by 张宋付
  11. 2016-03-26 20:56:22Reading Everything: read the whole file in one go by 风云轩
相关聚客文章
  1. Huqiu Liao / Srain 发表 2015-05-12 16:00:00 通过 shell 执行 python 报错: No such file or directory
  2. 博主 发表 2018-01-31 21:09:47 Fastest way to unzip a zip file in Python
  3. 博主 发表 2013-03-25 19:02:47 在python连接并使用kafka
  4. 博主 发表 2016-06-12 10:48:52 Guido老爹谈Python的未来
  5. dccmx 发表 2012-06-10 08:11:52 服务“编译器”(Service Compiler)
  6. dormy 发表 2016-06-22 09:54:58 Installing OpenCV 2.4.* with Python Support
  7. Qiang 发表 2011-09-08 14:06:00 Lexing Python Indentation using Spirit.Lex
  8. liuzhantao 发表 2016-07-01 07:19:16 python unicode str
  9. 博主 发表 2013-06-04 14:14:00 Integrating MongoDB Text Search with a Python App
  10. liuzhantao 发表 2016-07-06 12:09:04 Python运算符重载
  11. jyd 发表 2013-06-21 03:04:30 Sublime Text 2配置
  12. liuzhantao 发表 2016-07-08 09:37:56 Python重定向标准输入、标准输出和标准错误

发表评论