Files

Writing to a file:
f=open('outputfile','a+')
f.write('something\n')
f.write('something else\n')
f.write('another something else\n')
f.close()
Reading from a file:
f=open('inputfile','r')
for line in f:
  print line

f.seek(0) # rewind

for line in f:
  print line

f.close()