saving . . . saved i am using windows 10 and i am geting SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape has been deleted. i am using windows 10 and i am geting SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape has been hidden .
i am using windows 10 and i am geting SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
Title
Question
 hi sir, 
              i was trying this and i amfacing thiserror please helpme  

year, profit = loadtxt('C:\Users\DDay\Downloads\Compressed\company-a-data.txt', unpack=True)
  File "<ipython-input-7-27db1e0fb82c>", line 1
    year, profit = loadtxt('C:\Users\DDay\Downloads\Compressed\company-a-data.txt', unpack=True)
                                                                                  ^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

Python Other-types-of-plots 02-03 min 40-50 sec 04-05-21, 1:51 p.m. deepanshu181

Answers:

The problem is with the string

"C:\Users\Eric\Desktop\beeline.txt"
Here, \U in "C:\Users... starts an eight-character Unicode escape, such as \U00014321. In your code, the escape is followed by the character 's', which is invalid.

You either need to duplicate all backslashes:

"C:\\Users\\Eric\\Desktop\\beeline.txt"
Or prefix the string with r (to produce a raw string):

r"C:\Users\Eric\Desktop\beeline.txt"
09-07-21, 11:42 a.m. ankitrj.iitb


Log-in to answer to this question.