A list comprehension would work just fine:
[o.my_attr for o in my_list]
But there is a combination of built-in functions, since you ask 🙂
from operator import attrgetter
map(attrgetter('my_attr'), my_list)
More Related Contents:
- Is there a simple, elegant way to define singletons? [duplicate]
- Element-wise addition of 2 lists?
- Sum a list of numbers in Python
- Unable to locate element using selenium chrome webdriver in python selenium
- Scrapy Crawl URLs in Order
- bit-wise operation unary ~ (invert)
- Why use Flask’s url_for?
- How to invoke pandas.rolling.apply with parameters from multiple column?
- sqlalchemy: how to join several tables by one query?
- How to generate random numbers that are different? [duplicate]
- How can we JOIN two Spark SQL dataframes using a SQL-esque “LIKE” criterion?
- How to make a set of lists
- Recursively access dict via attributes as well as index access?
- How do I check if raw input is integer in python 2.7?
- What is %pylab?
- Fetch all href link using selenium in python
- double equals vs is in python [duplicate]
- Set up Python simpleHTTPserver on Windows [duplicate]
- Is there a difference between using a dict literal and a dict constructor?
- What do square brackets mean in pip install?
- How to run bash commands inside of a Python script [duplicate]
- interactive shell debugging with pycharm
- Wait until task is completed on Remote Machine through Python [duplicate]
- Python: Number of the Week in a Month
- No module named ‘openpyxl’ – Python 3.4 – Ubuntu
- How can I serialize a numpy array while preserving matrix dimensions?
- Installing MS C++ 14.0 for python without Visual Studio
- How to get `setup.cfg` metadata at the command line (Python)
- How to place inline labels in a line plot
- yaxis range display using absolute values rather than offset values