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)
Related Contents:
- Passing HTML to template using Flask/Jinja2
- What do __init__ and self do in Python?
- How do I concatenate text files in Python?
- Instance variables vs. class variables in Python
- How to upload file with python requests?
- Expanding tuples into arguments
- Execute code when Django starts ONCE only?
- Calculate cosine similarity given 2 sentence strings
- What are the differences between the threading and multiprocessing modules?
- How can I get the named parameters from a URL using Flask?
- Why is Python running my module when I import it, and how do I stop it?
- _tkinter.TclError: no display name and no $DISPLAY environment variable
- Label python data points on plot
- Changing the formatting of a datetime axis in matplotlib
- How can I make a Selenium script undetectable using GeckoDriver and Firefox through Python?
- ImportError: No module named _ssl
- pip cannot uninstall : “It is a distutils installed project”
- numpy.unique with order preserved
- Easy way of finding decimal places
- Reducing size of pyinstaller exe
- Installing SetupTools on 64-bit Windows
- Intraday candlestick charts using Matplotlib
- Error importing hashlib with python 2.7 but not with 2.6
- subprocess “TypeError: a bytes-like object is required, not ‘str'”
- Python: source code string cannot contain null bytes
- What is the fastest way to open urls in new tabs via Selenium – Python?
- How to save the Pandas dataframe/series data as a figure?
- Django multi tenancy
- How to get a list of all indices of repeated elements in a numpy array
- Closing Pygame Window
- Invalid syntax when using “print”? [duplicate]
- Introspection to get decorator names on a method?
- Jupyter Notebook 500 : Internal Server Error
- Get year, month or day from numpy datetime64
- What is %pylab?
- ImportError: No module named ‘selenium’
- Printing an int list in a single line python3
- Unicode identifiers in Python?
- How can I find the union of two Django querysets?
- Python 3 UnicodeDecodeError: ‘charmap’ codec can’t decode byte 0x9d
- How to fix python-selenium error “connection refused” when initializing a selenium webdriver?
- Convert pandas data frame to series
- Easiest way to rename a model using Django/South?
- Logarithmic y-axis bins in python
- Adding a ‘count’ column to the result of a groupby in pandas?
- Setting spacing between grouped bar plots
- How do I check if a string is valid JSON in Python?
- How to use “get_or_create()” in Django?
- Pandas DataFrame merge summing column
- CSV reader behavior with None and empty string