๐Python
Welcome to Python : ํจํค์ง
4:Bee
2023. 7. 24. 22:44
728x90
- ํด๋์ค : https://hi-code.tistory.com/123
- ๋ชจ๋ : https://hi-code.tistory.com/124
- ํจํค์ง : https://hi-code.tistory.com/125
- ์์ธ ์ฒ๋ฆฌ : https://hi-code.tistory.com/126
- ๋ด์ฅ ํจ์ : https://hi-code.tistory.com/127
- ํ์ค ๋ผ์ด๋ธ๋ฌ๋ฆฌ : https://hi-code.tistory.com/128
- ์ธ๋ถ ๋ผ์ด๋ธ๋ฌ๋ฆฌ :https://hi-code.tistory.com/129
| Title | Code | Console |
| ํจํค์ง ๋ง๋ค๊ธฐ |
def echo_test(): print("echo")
|
|
|
import game.sound.echo game.sound.echo.echo_test()
|
echo | |
| ํจํค์ง ๋ณ์ ๋ฐ ํจ์ ์ ์ |
# game/__init__.py
from .grahpic.render import render_test
VERSION = 3.5
def print_version_info():
print(f"The version of this game is {VERSION}.")
print("Initializing game...")
|
|
|
import game print(game.VERSION)
game.print_version_info()
|
3.5 The version of this game is 3.5. |
|
| __all__ |
#game/sound/__init__.py __all__ = ['echo']
|
*๋ค์ ํ์ธ ํ์ |
|
from game.sound import * echo.echo_test()
|
Initializing game... echo |
|
| relative ํจํค์ง |
# game/grahpic/render.py from ..sound.echo import echo_test
def render_test():
print("render")
echo_test()
|
|
|
from game.grahpic.render import render_test render_test()
|
Initializing game... render echo |
728x90