모듈과 import #python #tutorial
test.py
import report
DESCRIPTION = report.get_description()
print("Today's weather:", DESCRIPTION)
report.py
def get_description(): # ㅂㅏ로 아래에 docstring
"""Return random weather, just like the pros"""
from random import choice
possibilities = ['rain', 'snow', 'sleet', 'fog', 'sun', 'who knows']
return choice(possibilities)
import report as wr
DESCRIPTION = wr.get_description()
from report import get_description
DESCRIPTION = get_description()
from report import get_description as do_it
DESCRIPTION = do_it()