Python File IO

File IO

Basic Methods on File Objects

File Example

# copy the contents of one file to another
inFile = open('myfile_in')
outFile = open('myfile_out', 'w')

for line in file:
    outFile.write(line)

inFile.close()
outFile.close()

The with Keyword

File Formats