I need record the starting offsets of csv rows in a database for fast seeking 
later. 
Unfortunately, using any csv.reader() (or DictReader) tries to cache, which 
means:
example_Data = "'data
0123456789ABCDE
1123456789ABCDE
2123456789ABCDE
3123456789ABCDE
...
'''

for line in reader:
    offsets[row] = f.tell() 

is not possible. With my example data , offsets are reported as [0, 260, 260, 
260...] they should be [0x00, 0x00,0x15, 0x25, ...] (sample data is 16 byte 
rows after a 5 byte header (just for now)) 

I saw in one of PEP-305's references a mention of csv.parser() which won't 
return a row until parsing is complete. This is ideal since some lines will 
have quoted text containing commas and new lines.  I don't want to re-write the 
parser, since later usage will use csvDictReader, so we need to identically 
parse rows. How can I do that with the Python 2.7 csv module?

Or how can I accomplish this task through other means?
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to