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


/ Published in: Python
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  1. import operator
  2. map(operator.itemgetter(0), [(1,),(2,)])

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.