with open("filename.txt","r") as f: contents = f.read()
Simple way to get a directory of a file and open it: from tkinter.filedialog import askopenfilename filename = askopenfilename()