文件读写,,文件读写#第九章 文件#
文件读写,,文件读写#第九章 文件#
文件读写
#第九章 文件# -*- coding:utf8 -*- #文件最好不是中午的 我的也有乱码file = open("D:text.txt","w") #要指定路径,路径不区分大小写print filefile.write("Now is the time \n") #把这段话写到文件里面去file.write("to close the file ")file.close() #读写完成一定要关闭 不然文件读写失败print open("D:/text.txt").read() #并且打开此文件
相关内容
- 字典 暗示,字典,[Python]代码#
- 字典,,字典-基础# 字典#
- python Singleton pattern,pythonsingleton,Python singl
- while循环输出(1-10),while循环输出1-10,[Python]代码i
- python读取目录下文件并生成日志,,[Python]代码
- UTF8文件去BOM,UTF8文件BOM,[Python]代码#!
- python使用sha1加密方法验证文件的有效性,,import hashl
- 批量去除UTF8的Bom标签,utf8bom标签,#!/usr/bin/p
- 周长画圆,周长,[Python]代码im
- for循环,,[Python]代码ki
评论关闭