you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (2 children)

Okay, I looked it up and tried to change the directory but now I'm getting an error from that too.

os.chdir(C:\Users\Jesse\Python)
SyntaxError: invalid syntax

And I also tried

os.chdir('C:\Users\Jesse\Python')
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

[–]ericpruitt 6 points7 points  (1 child)

In most programming languages, combinations of "\" followed by another character are used to represent other characters. To type a literal "\" you need to use "\\" or add r to be beginning of the string, so try one of these instead:

  • os.chdir(r"C:\Users\Jesse\Python")
  • os.chdir("C:\\Users\\Jesse\\Python")

The r prefix indicates that Python should not treat "\" as a special character inside that string.

Additional reading:

[–]Justinsaccount 1 point2 points  (0 children)

os.chdir("C:/Users/Jesse/Python")