Posted By

fnurl on 04/26/09


Tagged

list flatten


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

iamok


flatten list of kind [(1,),(2,),(3,)] in python


 / Published in: Python
 

I made this ;) Python's operator class is what you need to know if you want to avoid using lambda functions or define your own helper functions in many cases.

  1. import operator
  2. map(operator.itemgetter(0), [(1,),(2,)])

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: fnurl on May 13, 2009

I use this to convert db output (results from one column only) to a list.

You need to login to post a comment.