1 개요[ | ]
- Python 딕셔너리 리스트 컬럼 join
- Python 딕셔너리 리스트 컬럼 추출하여 리스트 만들기
Python
Copy
members = [
{'id': 102, 'name': "Ashley Allen", 'address': "Seoul"},
{'id': 202, 'name': "Peter Parker", 'address': "New York"},
{'id': 104, 'name': "John Smith", 'address': "Tokyo"},
]
print(list(m['address'] for m in members))
## ['Seoul', 'New York', 'Tokyo']
Loading
Python
Copy
members = [
{'id': 102, 'name': "Ashley Allen", 'address': "Seoul"},
{'id': 202, 'name': "Peter Parker", 'address': "New York"},
{'id': 104, 'name': "John Smith", 'address': "Tokyo"},
]
print(tuple(m['address'] for m in members))
## ('Seoul', 'New York', 'Tokyo')
Loading
2 같이 보기[ | ]
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.