Archives Feb. 4, 2016

Python read and write files

Python read and write file

1.Python read and write file

fr=open("readfile.txt","r")  
fw=open("writefile.txt","w")

print fr.readline()  
print fr.tell()

print fr.readlines()  
fw.write("===write line===")  
fw.close()

fr.seek(0,0) #The first parameter represents the number of bytes, after which a parameter represents the relative ...

Continue reading

Previous day

Feb. 2, 2016

Next day

Feb. 11, 2016

Archives