Set File Path in Python | Delft Stack
www.delftstack.com › howto › pythonSep 12, 2021 · Use the Raw String Literals to Specify the File Path in Python. We can use raw string literals to provide paths for the files as a raw string will treat these backslashes as a literal character. To make a raw string, we have to write the r character before the quotes for the string. The syntax for using raw string literals is shown below. r'C:\Directory' Use the os.path() Function to Specify the File Path in Python. We can also use the path() function of the os module