Notice
Recent Posts
Recent Comments
Link
์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- ๋น๋๊ธฐ
- execCommand
- JS #ํ๋ก์ ํธ
- https://m.blog.naver.com/tt2t2am1118/221010125300
- ํผํ
- promise
- sql
- js
- json
- eport
- ์ฐธ๊ณ ๋ธ๋ก๊ทธ
- setTimeout()
- callback
- mysql
- ajax
- ๊ฒ์
- await
- async
- prj
- webpack
- Porject
- Project
- ๋๊ธฐ
- slow and steady
- object
- db
- addEventListener
- https://youtube.com/playlist?list=PLuHgQVnccGMA5836CvWfieEQy0T0ov6Jh&si=FTaYv8m21EhO-A2K
- database
- Import
Archives
- Today
- Total
C-log
Welcome to Python : ๋์ ๋๋ฆฌ ์๋ฃํ ๋ณธ๋ฌธ
728x90
- ๋ฌธ์์ด ์๋ฃํ : https://hi-code.tistory.com/110
- ๋ฆฌ์คํธ ์๋ฃํ : https://hi-code.tistory.com/111
- ํํ ์๋ฃํ : https://hi-code.tistory.com/112
- ๋์ ๋๋ฆฌ ์๋ฃํ : https://hi-code.tistory.com/113
- ์งํฉ ์๋ฃํ : https://hi-code.tistory.com/114
Title | Code | Console |
๋์ ๋๋ฆฌ ์๋ฃํ | ||
๋์ ๋๋ฆฌ ์ ์ถ๊ฐ |
a = {1: 'a'} a[2] = 'b'
print(a)
a['name'] = 'pey'
print(a)
a[3] = [1, 2, 3]
print(a)
|
{1: 'a', 2: 'b'} {1: 'a', 2: 'b', 'name': 'pey'} {1: 'a', 2: 'b', 'name': 'pey', 3: [1, 2, 3]} |
๋์ ๋๋ฆฌ ์์ ์ญ์ |
del a[1]
print(a)
|
{2: 'b', 'name': 'pey', 3: [1, 2, 3]} |
๋์ ๋๋ฆฌ Key ์ฌ์ฉํด value ์ป๊ธฐ |
grade = {'pey': 10, 'julliet': 99}
print(grade['pey'])
print(grade['julliet'])
|
10 99 |
a = {1: 'a', 2: 'b'}
print(a[1])
print(a[2])
|
a b |
|
๋์ ๋๋ฆฌ๋ ๋ฆฌ์คํธ๋ ํํ์ ์๋ ์ธ๋ฑ์ฑ ๋ฐฉ๋ฒ์ ์ ์ฉํ ์ ์๋ค. | ||
๋์ ๋๋ฆฌ ์ฃผ์ํ ์ฌํญ |
a = {1: 'a', 1: 'b'}
print(a) // 1 : 'a' ์์ด ๋ฌด์๋๋ค.
|
{1: 'b'} -> 1 : 'a' ์์ด ๋ฌด์๋๋ค. |
a = {[1, 2]: 'hi'} // ๋ฆฌ์คํธ๋ฅผ key๋ก ์ฌ์ฉ print(a)
|
Traceback (most recent call last): File "...Quiz.py", line 2, in <module> a = {[1, 2]: 'hi'} TypeError: unhashable type: 'list' -> ๋ฆฌ์คํธ๋ฅผ key๋ก ์ฌ์ฉ |
Title | Code | Console |
๋์ ๋๋ฆฌ ๊ด๋ จ ํจ์ | ||
keys |
a = {'name': 'pey', 'phone': '010-9999-1234', 'birth': '1118'}
print(a.keys())
|
dict_keys(['name', 'phone', 'birth']) |
๋ฆฌ์คํธ ๊ณ ์ ์ append, insert, pop, remove, sort ํจ์๋ ์ํํ ์ ์๋ค. | ||
values |
a = {'name': 'pey', 'phone': '010-9999-1234', 'birth': '1118'}
print(a.values())
|
dict_values(['pey', '010-9999-1234', '1118']) |
items |
a = {'name': 'pey', 'phone': '010-9999-1234', 'birth': '1118'}
print(a.items())
|
dict_items([('name', 'pey'), ('phone', '010-9999-1234'), ('birth', '1118')]) |
clear |
a = {'name': 'pey', 'phone': '010-9999-1234', 'birth': '1118'}
print(a.clear())
|
None |
get |
a = {'name': 'pey', 'phone': '010-9999-1234', 'birth': '1118'}
print(a.get('name'))
print(a.get('phone'))
|
pey 010-9999-1234 |
a = {'name': 'pey', 'phone': '010-9999-1234', 'birth': '1118'}
print(a.get['nokey'])
|
Traceback (most recent call last): File "...Quiz.py", line 3, in <module> print(a.ge('nokey')) AttributeError: 'dict' object has no attribute 'ge'. Did you mean: 'get'? |
|
in |
a = {'name': 'pey', 'phone': '010-9999-1234', 'birth': '1118'}
print('name' in a)
print('email' in a)
|
True False |
728x90
'๐Python' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Welcome to Python : ๊น์ ๋ณต์ฌ ์์ ๋ณต์ฌ (0) | 2023.07.09 |
---|---|
Welcome to Python : ์งํฉ ์๋ฃํ (0) | 2023.07.08 |
Welcome to Python : ํํ ์๋ฃํ (0) | 2023.07.08 |
Welcome to Python : ๋ฆฌ์คํธ ์๋ฃํ (0) | 2023.07.07 |
Welcome to Python : ๋ฌธ์์ด ์๋ฃํ (0) | 2023.07.06 |
Comments