in Python I have a number of tools to access files... if the file is a basic text file, I will use the built-in functions if the file is XML/JSON/CSV/etc i will use a module from the Standard Library if the file is other format (like YAML, etc) I may need to download a module to handle it to read/write a basic text/binary file using the built-in functions I need to answer a few questions: 1) where is the file, I need the path to it I can put the file in the same folder the Python code is it, and call the file by name (this is a relative path) name = "States.txt" fh = open(name) print(fh.readline()) fh.close() 2) I could put the file in a folder and create a "literal" path to the file name = r"C:\Users\Jonathan\PycharmProjects\Play\data\States.txt" fh = open(name) print(fh.readline()) fh.close() 3) I could ask the Python runtime to build the path to the file import os name = os.path.join('c:','\\', 'Users', 'Jonathan', 'PycharmProjects','Play','data','States.txt') print(name) fh = open(name) print(fh.readline()) fh.close() ---------------------------------------------------------------- once I open the file and have a FileHandler (pointer) I can A) read a single line: record = fh.readline() B) read all the lines into a list records = fh.readlines() C) read a "chunk" of the file as an array of bytes data = fh.read(100) D) I can write a single line to the file like: print("...",file=fh) fh.write("...") <- WARNING this will NOT add a newline to the data E) I can write a List of line to the file fh.writelines(list) ------------------------------------------------------ when I open the file open("path", 'options') <- the options include: r -> open for read w -> open for write x -> open for write exclusive (if the file already exists this will fail) t -> open as text file b -> open as binary file for example: fh = open(name, 'rt') (read/text) fh = open(name, 'wb') (write/binary)