输入:
read
readline()
readlines()
输出:
write()
writelines()
操作系统之间的差异:
1. 换行符的不同,windows是’/r/n’,linux和max是’/r’
2. 路径分隔符不同,windows下是’\’,linux和max是’/’
# coding= utf-8
import os
print "行分隔符:"
print os.linesep
print "文件路径分隔符:"
print os.pathsep
print "当前用户工作目录:"
print os.curdir
print "父目录:"
print os.pardir
file = open("main.py",'r')
for eachLine in file:
print eachLine
file = open("test.txt",'w')
file.write("dddddddddddddddd")
file.write("\r\n")
list = ["1111111",'2222222222','4444444444','999999999']
file.writelines(list)