On 04/23/2013 06:40 PM, Ana Dionísio wrote:
The condition I want to meet is in the first column, so is there a way to read
only the first column and if the condition is true, print the rest?
The CSV module will read a row at a time, but nothing gets printed till
you print it. So starting wi
The enumerate function should allow you to check whether you are in the
first iteration.
Like so:
for row_number, row in enumerate(csv.reader(<...>)):
if enumerate == 0:
if :
break
...
Enumerate allows you to know how far into the iterati
The condition I want to meet is in the first column, so is there a way to read
only the first column and if the condition is true, print the rest?
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Apr 23, 2013 at 2:58 PM, Ana Dionísio wrote:
> Thank you, but can you explain it a little better? I am just starting in
> python and I don't think I understood how to apply your awnser
> --
> http://mail.python.org/mailman/listinfo/python-list
>
#!/usr/local/pypy-1.9/bin/pypy
import csv
Thank you, but can you explain it a little better? I am just starting in python
and I don't think I understood how to apply your awnser
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Apr 23, 2013 at 2:39 PM, Ana Dionísio wrote:
> Hello!
>
> I need to read a CSV file that has "n" rows and "m" columns and if a
> certain condition is met, for exameple n==200, it prints all the columns in
> that row. How can I do this? I tried to save all the data in a
> multi-dimensional
Laurent RAHUEL wrote:
> I thought you knew the number of cols and what you should expect in each.
> Then it sounded pretty easy to build a list of dictionaries. If you don't
> know what you're supposed to find in your file and how this file is
> structured I guess you don't know what you are doing
John Machin wrote:
> Laurent RAHUEL wrote:
>> RFQ wrote:
>>
>>
>>>Hi, I'm struggling here to do the following with any success:
>>>
>>>I have a comma delimited file where each line in the file is something
>>>like:
>>>
>>>PNumber,3056,Contractor,XYZ Contracting,Architect,ABC Architects,...
>>
>
Laurent RAHUEL wrote:
> RFQ wrote:
>
>
>>Hi, I'm struggling here to do the following with any success:
>>
>>I have a comma delimited file where each line in the file is something
>>like:
>>
>>PNumber,3056,Contractor,XYZ Contracting,Architect,ABC Architects,...
>
>
> This is NOT a CSV file. A CS
RFQ wrote:
> Hi, I'm struggling here to do the following with any success:
>
> I have a comma delimited file where each line in the file is something
> like:
>
> PNumber,3056,Contractor,XYZ Contracting,Architect,ABC Architects,...
This is NOT a CSV file. A CSV file would be :
PNumber,Contracto
Sounds like you want to use the ConfigObject module.
http://www.voidspace.org.uk/python/modules.shtml#configobj
-dave
"RFQ" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi, I'm struggling here to do the following with any success:
>
> I have a comma delimited file where each lin
RFQ wrote:
> I have a comma delimited file where each line in the file is something
> like:
>
> PNumber,3056,Contractor,XYZ Contracting,Architect,ABC Architects,...
>
> So each line is intended to be: key1,value1,key2,value2,key3,value3...
> and each line is to be variable in length (although it
RFQ wrote:
> Hi, I'm struggling here to do the following with any success:
>
> I have a comma delimited file where each line in the file is something
> like:
>
> PNumber,3056,Contractor,XYZ Contracting,Architect,ABC Architects,...
>
> So each line is intended to be: key1,value1,key2,value2,key3,
13 matches
Mail list logo