1file = open("text.txt", "w")
2file.write("Your text goes here")
3file.close()
4'r' open for reading (default)
5'w' open for writing, truncating the file first
6'x' open for exclusive creation, failing if the file already exists
7'a' open for writing, appending to the end of the file if it exists
1file = open('test.txt')
2for line in file:
3 fields = line.strip().split()
4 print fields[0], fields[1], fields[2], fields[3]
5