파이썬 딕셔너리(dict)의 값(value)들을 모아 리스트 생성

파이썬에서 딕셔너리(dict)에 저장된 값들을 모아서 리스트(list)를 만들 수 있습니다. 예시를 보면 금방 알 수 있습니다.

x_dict = {'a':1, 'b':2, 'c':3}

x_vals = x_dict.values()

딕셔너리에서 values() 함수는 딕셔너리의 값들을 모아 dict_values라는 객체를 생성해서 반환합니다. 이것은 리스트가 아니므로 리스트로 변환해 주면 되겠습니다.

x_list = list(x_vals)

print(x_list)

[1, 2, 3]


@joviansummer의 스팀 프로젝트

스팀 증인노드를 운영중입니다. @jswit에 증인투표해 주시면 감사하겠습니다.
(https://steemitwallet.com/~witnesses)

jswit 증인 노드 프로젝트를 시작합니다.

jsup 업보팅(upvoting) 서비스 소개

jsup 수혜자 지정 기능 추가

jsup 서비스에 큐레이션 보상 분배 기능이 추가되었습니다.

jSTEEM 프로젝트 - 텔레그램 챗봇으로 구현하는 스팀 블럭체인 탐색기

STEEM.NFT - 디지털 아트 보존 프로젝트



Posted through the AVLE Dapp (https://avle.io)

Sort:  

Thank you, friend!
I'm @steem.history, who is steem witness.
Thank you for witnessvoting for me.
image.png
please click it!
image.png
(Go to https://steemit.com/~witnesses and type fbslo at the bottom of the page)

The weight is reduced because of the lack of Voting Power. If you vote for me as a witness, you can get my little vote.

Upvoted! Thank you for supporting witness @jswit.

Coin Marketplace

STEEM 0.04
TRX 0.31
JST 0.074
BTC 63807.58
ETH 1667.04
USDT 1.00
SBD 0.42