On Mon, 29 Dec 2014 10:32:03 -0600, Skip Montanaro wrote:
> On Mon, Dec 29, 2014 at 10:11 AM, JC wrote:
>> Do I have to open the file again to get 'rdr' work again?
>
> Yes, but if you want the number of records, just operate on the rows
> list, e.g. len(rows).
>
On Mon, 29 Dec 2014 09:47:23 -0600, Skip Montanaro wrote:
> On Mon, Dec 29, 2014 at 9:35 AM, JC wrote:
>> How could I get the all the records?
>
> This should work:
>
> with open('x.csv','rb') as f:
> rdr = csv.DictReader(f,delimiter=','
Hello,
I have csv file like:
id,name,userid,password
1,ABC,def@ghi,1234
2,DEF,ghi@jkl,asdf
3,GHI,jkl@mno,zxcv
.
.
.
I need to get that csv file into a dictionary. Here is my code:
import csv
with open('x.csv','rb') as f:
rdr = csv.DictReader(f,delimiter=',')
flds = rdr.fieldnames
r
On Sun, 28 Dec 2014 14:41:55 +0200, Jussi Piitulainen wrote:
> Skip Montanaro writes:
>
>> > ValueError: I/O operation on closed file
>> >
>> > Here is my code in a Python shell -
>> >
>> > >>> with open('x.csv','rb') as f:
>> > ... r = csv.DictReader(f,delimiter=",")
>> > >>> r.fieldnames
>>
On Sun, 28 Dec 2014 06:19:58 -0600, Skip Montanaro wrote:
>> ValueError: I/O operation on closed file
>>
>> Here is my code in a Python shell -
>>
>> >>> with open('x.csv','rb') as f:
>> ... r = csv.DictReader(f,delimiter=",")
>> >>> r.fieldnames
>
> The file is only open during the context o
Hello,
I am trying to read a csv file using DictReader. I am getting error -
Traceback (most recent call last):
File "", line 1, in
r.fieldnames
File "/usr/lib/python2.7/csv.py", line 90, in fieldnames
self._fieldnames = self.reader.next()
ValueError: I/O operation on closed file
He
Hello,
Is it possible in python:
if ((x = a(b,c)) == 'TRUE'):
print x
Thanks.
--
https://mail.python.org/mailman/listinfo/python-list
# Get Fibonacci Value
#Fibonacci(N) = Fibonacci(N-1) + Fibonacci(N-2)
#
# n = 900 is OK
# n = 1000 is ERROR , Why
#
# What Wrong?
#
cache = []
def fibo( n ):
try:
if cache[n] != -1:
return cache[n]
else:
if 0 == n:
r = 0
Adam wrote:
> Where should a py newbie start to do some 2D graphs on screen ?
>
> PythonGraphApi,
> Gato, looks interesting
> pygraphlib,
> matplotlib,
>
> is there a best native Python place to start ?
>
>
>
If you are going to be in wxPython try the 'PyPlot.py' examples in the