[原]Python 简单文件处理

仅仅是为了Linux操作方便= =命令行最近没有时间仔细看看,电脑一直都在机房,暂且这般记着吧= =

spath="D:/download/baa.txt"
f=open(spath,"w") # Opens file for writing.Creates this file doesn't exist.
f.write("First line 1.\n")
f.writelines("First line 2.")

f.close()

f=open(spath,"r") # Opens file for reading

for line in f:
    print line

f.close()

raw_input("press any key to continue...")

作者:svitter 发表于2014-5-2 23:31:49 原文链接
阅读:19 评论:0 查看评论
posted @ 2014-05-02 23:32  svtter  阅读(164)  评论(0编辑  收藏  举报