File writelines(list)
f = open(r'c:\text\somefile.txt') lines = f.readlines() f.close() lines[1] = "isn't a\n" f = open(r'c:\text\somefile.txt', 'w') f.writelines(lines) f.close()
1. | Writing to Files | ||
2. | File write(string) | ||
3. | Looping Over Characters with read Writing the Loop Differently | ||
4. | File Output | ||
5. | Writes the contents of string to the file |