Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > RE: Flat file to associative array.

Thread Tools

RE: Flat file to associative array.

Delaney, Timothy C (Timothy)
Posts: n/a
> From: Alex [(E-Mail Removed)]
> What would be the best way to convert a flat file of products into
> a multi-dimensional array? The flat file looks like this:
> Beer|Molson|Dry|4.50
> Beer|Molson|Export|4.50
> Shot|Scotch|Macallan18|18.50
> Shot|Regular|Jameson|3.00

Have you tried any of the CSV/DSV (delimiter-separated libraries). They may be overkill, but you may also be able to get a 1 or 2 line solution out of them.

Tim Delaney

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Generate an associative array from a file Mr_Noob Perl Misc 12 02-29-2008 08:41 PM
Why "associative" in associative container? desktop C++ 5 06-26-2007 07:49 AM
XSLT to transform a "flat" XML file into a structured text file R. P. XML 3 06-22-2006 02:26 AM
How to read associative array from file? nospam Perl 2 06-26-2004 09:46 AM
Flat file to associative array. Alex Python 2 07-22-2003 01:59 PM