Extract list of attributes from list of objects in python

attrs = [o.attr for o in objs] was the right code for making a list like the one you describe. Don’t try to subclass list for this. Is there something you did not like about that snippet?

Leave a Comment