[issue26116] CSV-module. The example code don't work. Have to be: reader = csv.reader(csvfile, dialect=dialect)

Василь Коломієць report at bugs.python.org
Thu Jan 14 18:20:31 EST 2016


Василь Коломієць added the comment:

I am very happy!
Thx for attention to my opinion.
Sorry for my english.

so - in attachment two codes and source csv-file.

With best wishes,
Vasyl Kolomiets.
+38050 45 22 559

2016-01-15 0:38 GMT+02:00 Georg Brandl <report at bugs.python.org>:

>
> Georg Brandl added the comment:
>
> We'll need at least the two full examples (one not working, one working)
> to make a call here.
>
> ----------
> nosy: +georg.brandl
>
> _______________________________________
> Python tracker <report at bugs.python.org>
> <http://bugs.python.org/issue26116>
> _______________________________________
>

----------
Added file: http://bugs.python.org/file41617/may_be-error_csv_exmpl.py
Added file: http://bugs.python.org/file41618/from_to_proportions.csv
Added file: http://bugs.python.org/file41619/may_be-good_csv_exmpl.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26116>
_______________________________________
-------------- next part --------------
from tkinter import *
from PIL import Image
import csv

filename = "from_to_proportions.csv"
with open(filename) as csvfile:
    dialect=csv.Sniffer().sniff(csvfile.read(1024))
    csvfile.seek(0)
    print(dialect)
    readed = csv.DictReader(csvfile, dialect)
    for row in readed:
        print(row)
        print (row["from_id"],row["from_name"],row['to_id'],row['to_name'],
               row['barcodes_percentage'],row['rows_to_be'])
        
-------------- next part --------------
A non-text attachment was scrubbed...
Name: from_to_proportions.csv
Type: text/csv
Size: 764 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-bugs-list/attachments/20160114/efa38943/attachment-0001.csv>
-------------- next part --------------
from tkinter import *
from PIL import Image
import csv

filename = "from_to_proportions.csv"
with open(filename) as csvfile:
    dialect=csv.Sniffer().sniff(csvfile.read(1024))
    csvfile.seek(0)
    print(dialect)
    readed = csv.DictReader(csvfile, dialect=dialect)
    for row in readed:
        print(row)
        print (row["from_id"],row["from_name"],row['to_id'],row['to_name'],
               row['barcodes_percentage'],row['rows_to_be'])
        


More information about the Python-bugs-list mailing list