Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to open a csv file in python 3 and when ever I do it says (Unicode error)'unicodeescape' codec can't decode bytes in position 2-3: truncated /UXXXXXXXX escape

It highlights the ( after open/ before 'C:\Users\Me\Desktop\csv file.csv'

I'm not sure what the error is since I don't know what it meant with the Unicode error

This is the code:

Python
import csv
with open('C:\Users\Me\Desktop\csv file.csv') as csvfile:
    y = csv.reader(csvfile, delimiter=',')
    Names = []
    Ages = []
    for x in y:
        print(row[0], row[1])


What I have tried:

I can't think of anything to try
Posted
Updated 1-Mar-18 22:17pm

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900