© 2004-21

Python File Handling
TXT Files

Text files are used to store data that is unstructured ie the lines can be any length and don't have any special format or content
The end of the line has a new line character (This can't normally be seen as it's a non printing character)
Text files should always have a .txt file extension.
They look like this:

Click here to download a sample TXT file

Method Description
Read TXT by line data Read data from a text file line by line
Read TXT data Read data from a text file
Write TXT data Write data to a text file and add newline characters