1、出现错误
train_df = pd.read_csv(
'C:\Users\lenovo\Desktop\train.csv',encoding='utf-8')
报错:
File
"<ipython-input-45-27822e1fee69>"
, line
1
train_df = pd.read_csv('C:\Users\lenovo\Desktop\train.csv',encoding='utf-8')
^
SyntaxError : (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
train_df = pd.read_csv('C:\Users\lenovo\Desktop\train.csv',encoding='utf-8')
^
SyntaxError : (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
2、 解决方案
文件名前面加r