"Python 딕셔너리 리스트 컬럼 추출하여 리스트 만들기"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-<source +<syntaxhighlight , -</source> +</syntaxhighlight>))
 
(다른 사용자 한 명의 중간 판 4개는 보이지 않습니다)
3번째 줄: 3번째 줄:
;Python 딕셔너리 리스트 컬럼 추출하여 리스트 만들기
;Python 딕셔너리 리스트 컬럼 추출하여 리스트 만들기


<source lang='python' run>
<syntaxhighlight lang='python' run>
members = [
members = [
{'id': 102, 'name': "Ashley Allen", 'address': "Seoul"},
{'id': 102, 'name': "Ashley Allen", 'address': "Seoul"},
11번째 줄: 11번째 줄:
print(list(m['address'] for m in members))
print(list(m['address'] for m in members))
## ['Seoul', 'New York', 'Tokyo']
## ['Seoul', 'New York', 'Tokyo']
</source>
</syntaxhighlight>
<source lang='python' run>
<syntaxhighlight lang='python' run>
members = [
members = [
{'id': 102, 'name': "Ashley Allen", 'address': "Seoul"},
{'id': 102, 'name': "Ashley Allen", 'address': "Seoul"},
20번째 줄: 20번째 줄:
print(tuple(m['address'] for m in members))
print(tuple(m['address'] for m in members))
## ('Seoul', 'New York', 'Tokyo')
## ('Seoul', 'New York', 'Tokyo')
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==
* [[Python 딕셔너리 리스트]]
* [[Python 딕셔너리 리스트]]
* [[Python 딕셔너리 리스트를 딕셔너리로 변환]]
* [[파이썬 딕셔너리 값 추출하여 리스트로 만들기]]
* [[파이썬 딕셔너리 값 추출하여 리스트로 만들기]]
* [[딕셔너리 리스트 컬럼 추출하여 리스트 만들기]]
* [[함수 pluck()]]


[[분류: Python 딕셔너리 리스트]]
[[분류: Python 딕셔너리 리스트]]
[[분류: Python 문자열 리스트]]
[[분류:Python 리스트 컴프리헨션]]
[[분류:Python 리스트 컴프리헨션]]

2021년 3월 11일 (목) 12:15 기준 최신판

1 개요[ | ]

Python 딕셔너리 리스트 컬럼 join
Python 딕셔너리 리스트 컬럼 추출하여 리스트 만들기
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']
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')

2 같이 보기[ | ]