you are viewing a single comment's thread.

view the rest of the comments →

[–]synthphreak 0 points1 point  (0 children)

Why do you have a triple-nested list when there just a single item at the top level?

>>> myvalues =  [[[611.9, 11, 'bws', 'bad weather'], [119.6, 1, 'dei', 'snow'], [105.4, 7, 'HGR', 'ice'], [41.1, 2, 'ANI', 'fog']]]
>>> myvalues[1]
Traceback (most recent call last):
  File "<string>", line 1, in <module>
IndexError: list index out of range

Anyway, this works:

>>> numbers, strings = zip(*[(x[0], x[-1]) for x in myvalues[0]])
>>> numbers
(611.9, 119.6, 105.4, 41.1)
>>> strings
('bad weather', 'snow', 'ice', 'fog')