I initially tried using that function however import_from_csv_file()
doesn't work with this file. I also tried using a few lines of code to
manipulate the data into something import_from_csv_file would like and
write that to a .csv then try importing it, but had no luck. Below are the
contents of the file:
A,00002,000282,15,r,1:08:34
PM,2/2/2014,BCC,,BCC,,BCC,,BCC,,BCC,,BCC,,BCC,,,,,,,,,,,,,,,,,,,
A,00002,000282,15,r,1:08:46
PM,2/2/2014,BCC,,BCC,,BCC,,BCC,,BCC,,BCC,,BCC,,,,,,,,,,,,,,,,,,,
A,00003,000282,15,R,1:20:05
PM,2/2/2014,BCC,,BCC,,BCC,,BCC,,BCC,,BCC,,BCC,,,,,,,,,,,,,,,,,,,
A,00012,000282,15,R,1:20:37
PM,2/2/2014,BCC,,BCC,,BCC,,BCC,,BCC,,BCC,,BCC,,,,,,,,,,,,,,,,,,,
A,00056,000282,15,R,1:29:09
PM,2/2/2014,BCC,,BCC,,BCC,,BCC,,BCC,,BCC,,BCC,,,,,,,,,,,,,,,,,,,
And, as a note I cannot change the formatting of this .csv file as it is
being generated by a computer running Windows NT using proprietary
software. Changing the format would require the that company to rewrite
part of their software.
On Wednesday, April 3, 2013 5:40:01 PM UTC-4, David S wrote:
>
> I'm very new to web2py and python in general but have a bit of knowledge
> when it comes to C/C++.
>
> I've got a db setup which needs to pull data from a row in a .csv file and
> put each column in the .csv into the corresponding column in the db. Rather
> than doing this explicitly (there's ~40 columns), I'd like to have each
> iteration of the for loop correspond to one of the columns. Here's what
> I've got so far:
>
> for lines in import_data:
> info = lines.split(',')
> field_name = 'field1'
> db[csv_data].insert(**{field_name:info})
>
> The above puts all the data in 'field1' and not into separate columns,
> close but not quite. I'm thinking some sort of select from the db might
> work. Any ideas or links which might help?
>
> Thanks,
> David
>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.