Created
March 25, 2018 01:37
-
-
Save jennyonjourney/dbac1abc04baedb4b01521bc790ab633 to your computer and use it in GitHub Desktop.
Python - dictionary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dic2 = {'키':157, | |
'나이':26, | |
'이름':'이은혜', | |
'성별':'여자'} | |
print(dic2) | |
print(dic2['나이']) | |
dic2 = {'키':157, | |
'나이':26, | |
'이름':'이은혜', | |
'성별':'여자', | |
'kk':[11,22,33,44], | |
#불가능 [234,567]:345, | |
(234,567):345, | |
0:3.14} | |
print(dic2) | |
print(dic2['키']) | |
print(dic2[(234,567)]) | |
print(dic2[0]) | |
dic2['국가'] = '대한민국' | |
print(dic2) | |
del dic2[(234,567)] | |
print(dic2) | |
print(200 in dic2) | |
print('------keys-------') | |
kkk = dic2.keys() | |
print(kkk) | |
for i in kkk: | |
print(i) | |
print('------values-------') | |
vvv=dic2.values() | |
print(vvv) | |
for i in vvv: | |
print(i) | |
print('------value만 보기--------') | |
iii=dic2.items() | |
print(iii) | |
for i in iii: | |
print(i[0], i[1]) | |
print('------key/value 같이 보기------') | |
for i in dic2: | |
print(i, dic2[i]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment