Skip to content

Latest commit

 

History

History
102 lines (68 loc) · 1.86 KB

python-import-module.md

File metadata and controls

102 lines (68 loc) · 1.86 KB

目录结构

-- py
       --__init__.py
       --hello.py
       --main.py

#from uu.hello import *
import hello
print("dsfaf")

#helloWorld()
hello.helloWorld()

a = input("程序结束!")
from hello import *
#import hello
print("dsfaf")

helloWorld()
#hello.helloWorld()

a = input("程序结束!")

目录结构
-- py
          -- uu
                    --pycache
                    --__init__.py
                    --hello.py

          --__init__.py
          --main.py

from uu.hello import *
#import uu.hello

print("dsfaf")

helloWorld()
# uu.hello.helloWorld()

a = input("程序结束!")
#from uu.hello import *
import uu.hello

print("dsfaf")

#helloWorld()
uu.hello.helloWorld()

a = input("程序结束!")

image

目录结构
-- py
       --__init__.py
       --main.py

from mylib.hello import *
#import hello
print("dsfaf")

helloWorld()
#hello.helloWorld()

a = input("程序结束!")
#from mylib.hello import *
import mylib.hello
print("dsfaf")

#helloWorld()
mylib.hello.helloWorld()

a = input("程序结束!")

效果图:
image