how to create a new file with python in a directory code example Example: create file in a specific directory python f = open(r"C:\Test.py", "a")