[python-events] I find a bug of python

M.-A. Lemburg mal at egenix.com
Thu Jun 14 04:53:35 EDT 2018


Hello,

this is the Python event mailing list and not the right place to
submit Python bug report. You should open a report on our
issue tracker instead:

https://bugs.python.org/

If you want to discuss the report with others, it's probably
best to ask on comp.lang.python or the sync'ed mailing list
list https://mail.python.org/mailman/listinfo/python-list.

Cheers,
-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Experts (#1, Jun 14 2018)
>>> Python Projects, Coaching and Consulting ...  http://www.egenix.com/
>>> Python Database Interfaces ...           http://products.egenix.com/
>>> Plone/Zope Database Interfaces ...           http://zope.egenix.com/
________________________________________________________________________

::: We implement business ideas - efficiently in both time and costs :::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/
                      http://www.malemburg.com/



On 14.06.2018 10:47, 李远志 wrote:
> hello , when you run this code:
> import csv
> csvFile = open('mycve.csv','r')
> csv_reader = csv.reader(csvFile)
> print list(csv_reader )
> print list(csv_reader )
> 
> you will find that first 'print' can print the content of mucve.csv
> successfully , but the second print will print an empty list
> when I try to solve this question , I find that csv_reader's
> line_num variable is the length of mycve.csv after first print function.
> so when I start the second print , I will get an empty list 
> I try to solve like this after first print  :
> csv_reader.line_num = 0
> but it's a readonly attribute.
> I know when we programming , we can solve this bug like this :
> a = list(csv_reader)
> print a
> print a
> 
> but when we want to use csv_reader again , we will get an empty
> list,maybe some people will doubt when they code like this:
> a = list(csv_reader)
> b = list(csv_reader)
> 
> why 'b' is empty!!?
> this is a little bug of python,but I hope you can solve this ,wish
> python better and better
> 
> 
> _______________________________________________
> python-events mailing list
> python-events at python.org
> https://mail.python.org/mailman/listinfo/python-events
> 
> Calendar wiki page: https://wiki.python.org/moin/PythonEventsCalendar
> 



More information about the python-events mailing list