파이썬[Python]: 내장함수 - __package__ 변수
내장함수 - __package__ 변수(variable)
/// 설명
패키지의 이름을 표현합니다. A Variable in Python Standard
※ 형식
__package__
reference
https://docs.python.org/3/reference/import.html
※ 형식
__package__
reference
https://docs.python.org/3/reference/import.html
/// 예제
1 | print(__package__) # None | cs |
/// 예제
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 | # try if you have a package import kivy import kivy.uix import kivy.uix.button from kivy.uix.button import Button print(kivy.__package__) # kivy print(kivy.uix.__package__) # kivy.uix print(kivy.uix.button.__package__) # kivy.uix # print(kivy.uix.button.Button.__package__) # Error __package__ = '__package__' print(__package__) # __package__ kivy.__package__ = 'kivy.__package__' print(kivy.__package__) # kivy.__package__ kivy.uix.__package__ = 'kivy.uix.__package__' print(kivy.uix.__package__) # kivy.uix.__package__ kivy.uix.button.__package__ = 'kivy.uix.button.__package__' print(kivy.uix.button.__package__) # kivy.uix.button.__package__ # package = module # package.subpackage = module # package.subpackage.module = module # # packages ( Regular packages, Namespace packages ) | cs |
* 실행환경: Microsoft Windows 10 Homes
* 인터프리터: 파이썬(Python 3.9)
– 당신을 응원합니다. –
댓글
댓글 쓰기