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
- count()
- glob
- discard()
- Database
- HTML
- __annotations__
- __sub__
- locals()
- zipfile
- 오버라이딩
- items()
- __len__
- randrange()
- 파이썬
- View
- fileinput
- shuffle()
- choice()
- node.js
- mro()
- inplace()
- MySqlDB
- MySQL
- JS
- shutil
- decode()
- CSS
- remove()
- __getitem__
- fnmatch
Archives
- Today
- Total
목록스코프 (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