Message94340
| Author |
W00D00 |
| Recipients |
W00D00 |
| Date |
2009年10月22日.10:46:04 |
| SpamBayes Score |
0.00064456195 |
| Marked as misclassified |
No |
| Message-id |
<1256208366.7.0.205796618954.issue7185@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
The CSV module try to read a .csv file which is coded in utf-8 with utf-
8 BOM.
The first row in the csv file is
["value","vocal","vocal","vocal","vocal"]
in hex:
"value","vocal","vocal","vocal","vocal"
the reader can not read corectly the first row and if I try to seek up
to 0 somewhere in the file I got an error like this:
['\ufeff"value"', 'vocal', 'vocal', 'vocal', 'vocal']
I think the csv reader is not seekable correctly.
I attached a test file for the bug and here is my code:
import codecs
import csv
InDistancesFile = codecs.open( '..\\distances.csv', 'r', encoding='utf-
8' )
InDistancesObj = csv.reader( InDistancesFile )
for Row in InDistancesObj:
if Row[0] == '20':
print(Row)
break
InDistancesFile.seek(0)
for Row in InDistancesObj:
print(Row) |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2009年10月22日 10:46:06 | W00D00 | set | recipients:
+ W00D00 |
| 2009年10月22日 10:46:06 | W00D00 | set | messageid: <1256208366.7.0.205796618954.issue7185@psf.upfronthosting.co.za> |
| 2009年10月22日 10:46:05 | W00D00 | link | issue7185 messages |
| 2009年10月22日 10:46:04 | W00D00 | create |
|