I have a list of fields in this form
fields = [{'name':'count', 'label':'Count'},{'name':'type', 'label':'Type'}]
I'd like to extract just the names and put it in a list. Currently, I'm doing this:
names = []
for field in fields:
names.append(field['name'])
Is there another way to do the same thing, that doesn't involve looping through the list.
I'm using python 2.7.
Thanks for your help.!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…