4 Reusable Code Snippet Topics

Remove Filter
Member Avatar for
Member Avatar for vegaseat

Shows how to convert a comma separated value (csv) string to a list of records, and then do some data processing. The csv strings usually come from csv files created by spreadsheets.

Member Avatar for vegaseat
1
3K
Member Avatar for ddanbe

The test.txt file I'm using is: 1,2,3,Name1,Pizza,Pizza Hut,7,8,9 1,2,3,Name2,goose,my home,7,8,9 1,2,3,Name3,chicken,airplane,7,8,9 Most of the explanation can be found in the snippet. Some CSV(Comma Separated Value) files often contain as first line, a header. You could skip this, or threat it a bit differently. I had no header, so I leave …

Member Avatar for deceptikon
0
3K
Member Avatar for G_Waddell

Hi All, In my opinion, this is the best way to read in text from a csv file. Take for example if you are importing addresses: "1 Main Street","SmallTown","SmallCounty" The above is fine and easy to parse in BUT what if an address like this was entered: "App 1A, Tall …

Member Avatar for Nutster
1
5K
Member Avatar for TrustyTony

The code from my answer to thread: [url]http://www.daniweb.com/forums/thread292949.html[/url] Any field names with any same separator separating the values. This is straight text file reading routine, see the original thread for csv module based code. sample.dat: [CODE]id; name; email; homeaddress 123; gishi; gishi@mymail.com; 456 happy st. 345; tony; tony.veijalainen@somewhere.com; Espoo Finland …

Member Avatar for TrustyTony
0
1K

The End.