I tried to confirm if a file exists using the following line of code:
os.path.isfile()
But I noticed if back slash is used by copy&past
Because backslashes are escapes in Python. Specifically, you get a Unicode error because the \U
escape means "Unicode character here; next 8 characters are a 32-bit hexadecimal codepoint."
If you use a raw string, which treats backslashes as themselves, it should work:
os.path.isfile(r"C:\Users\xxx\Desktop\xxx")