backslash in reading bytes

Dravidan yennes at gmail.com
Thu Mar 20 11:24:49 CET 2008


I am trying to read some byte data as a string then using a library to
convert them a code:

>>>reader = csv.DictReader(open('table.txt'))
>>>def eleFind(value):
>>>	for row in reader:
>>>		if row['byteCode'] == value:
>>>			print row['Element']
>>>			return
>>>		else:
>>>			print "No Match Found:"
>>>eleFind('\x00\x00')

My table contains:

\x00\x00,0000
\x01\x00,0000
......

The program errors out.  How can I fix/overide this backslash issue.



More information about the Python-list mailing list