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,...
>> 
>> 
>> This is NOT a CSV file. A CSV file would be :
>> 
>> PNumber,Contractor,Architect,...
>> 2056,XYZ Contracting,ABC Architects,...
>> 
> 
> CSV is an acronym for "Comma-Separated Values". It does not imply
> anything about the contents of the fields. The OP's file *is* a CSV
> file. Yes, the contents do represent an unusual application of the CSV
> format -- however a bus full of parcels instead of people is still a bus.

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.

> 
>> Then, you could use the built-in CSV module of recent python versions.
> 
> Python is a case-sensitive language. The name of the module is "csv".
> The OP could use the csv module with his data.

Damn, that's why I always see those annoynig import errors.

I just wanted to help, maybe you're to much case-sensitive.

Regards,

Laurent.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to