Search code examples
pythonpycharm

How to fix python Syntax error unicodeescape error?


so I have a error after running this code, I have no idea what is wrong with it. Could someone help me with that please?


Solution

  • You need to escape the \ in your path. You can do that with \\ or with a raw string.

    # Escape
    path = "C:\\users\\something\\a"
    
    # Or with a raw string
    path = r"C:\users\something"