#-*- coding: UTF-8 -*-
#同一个文件夹下可以直接import
#import hello
#from hello import print_hello
#不在同一个文件夹下通过添加路径的方式引用
import sys
sys.path.append('/home/focus/study/python/hello')
from hello import print_hello
print_hello()
~
导入包的原理类似
#-*- coding: UTF-8 -*-
#同一个文件夹下可以直接import
#import hello
#from hello import print_hello
#不在同一个文件夹下通过添加路径的方式引用
import sys
sys.path.append('/home/focus/study/python/hello')
from hello import print_hello
print_hello()
~
导入包的原理类似