The open() method is used to work with file and the os module along with its methods are used to work with directories with open("text.txt","r") as file: lines_in_file = file.readlines() Python File I/O: Read and Write Files in Python Python Directory and Files Management