[Chicago] Using split to arrays

J. D. Jordan zanson at zanson.org
Mon Mar 12 19:47:25 CET 2012


Is your issue that you want stuff not to be strings?  What you
currently have is details[0] is
['09:30:17', '100', '120.42', '', '']
It is an array of strings, which can be treated as lists.  If you want
to get the stuff to not be strings you will need to parse them...
Something like
notStrings = [datetime.strptime(details[0][0], "%H:%M:%S").time(),
int(details[0][1]), float(details[0][2]), int(details[0][3]) if
details[0][3] else 0, int(details[0][4]) if details[0][4] else 0]

On Mon, Mar 12, 2012 at 1:10 PM, Daniel Peters <danieltpeters at gmail.com> wrote:
> You might also checkout csvkit.  pretty sweet replacement for the csv stdlib
> module.
>
>
> http://csvkit.readthedocs.org/en/latest/index.html
>
>
> On Mon, Mar 12, 2012 at 12:33 PM, Freddy Martinez
> <freddymartinez9 at gmail.com> wrote:
>>
>> Sorry that should read:
>>
>>  [0, 09:30:17,100,120.42,0 ] (where the last element is blank or zero)
>> _______________________________________________
>> Chicago mailing list
>> Chicago at python.org
>> http://mail.python.org/mailman/listinfo/chicago
>
>
>
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago
>


More information about the Chicago mailing list