I am encountering an issue while using the csv module.
Here is my code
import csv
out = open('C:\Python27\Work\test.csv')
data = csv.reader(out)
data = [row for row in data]
out.close()
print data
The error I get is thus:
Line 3 in module,
out = open('C:\Python27\Work\test.csv')
IOError: [Errno 22] invalid mode ('r') or filename: 'C:\\Python27\\work\test.csv'
I'm confused because in the IOError it shows two backslashes (\) rather than one, which is very strange.
I've tried setting the mode to 'r', and 'rb' but nothing works.
When I use a different csv file, everything works just fine, and I get the output desired.