how to reference a python file in python code example Example: how to reference a file in python with open("filename.txt","r") as f: contents = f.read()