250x250
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
- __getitem__
- JS
- discard()
- fileinput
- shutil
- View
- zipfile
- mro()
- CSS
- shuffle()
- remove()
- inplace()
- MySQL
- HTML
- Database
- fnmatch
- items()
- glob
- __annotations__
- locals()
- choice()
- randrange()
- MySqlDB
- 파이썬
- count()
- node.js
- __len__
- decode()
- __sub__
- 오버라이딩
Archives
- Today
- Total
목록locals() (1)
흰둥이는 코드를 짤 때 짖어 (왈!왈!왈!왈!왈!왈!왈!왈!왈!왈!왈!)

1. 스코프(scope) 변수의 접근할 수 있는 범위 local: 가장 가까운 함수안의 범위 global: 함수 바깥의 변수 또는 import된 module In [1]: num1 = 10 # 글로벌 변수 def func1(): num2 = 20 # 로컬 변수 print(num2) In [2]: print(num1) print(num2) # NameError: name 'num2' is not defined 10 --------------------------------------------------------------------------- NameError Traceback (most recent call last) in 1 print(num1) ----> 2 print(num2) NameErro..
파이썬 기초
2023. 3. 9. 12:36