示例:
文件c.py
def fun():
print "A function."
str="A String"
文件a.py
from c import *
fun()
print str
输出:
A function.
A String
文件b.py
import c
c.fun()
print c.str
输出:
A function.
A String
如果要用class直接调用,调用from c import *就可以了,比如tornado
示例:
文件c.py
def fun():
print "A function."
str="A String"
文件a.py
from c import *
fun()
print str
输出:
A function.
A String
文件b.py
import c
c.fun()
print c.str
输出:
A function.
A String
如果要用class直接调用,调用from c import *就可以了,比如tornado