您的位置:首页 > 编程语言 > Python开发

python的import几种形式

2016-05-10 16:25 513 查看
python的import的几种形式:在t1.py中
def out():
print('this is t1')
<pre name="code" class="python">def hello():
print('hello world')
在t3.py中
import t1t1.out()
前面需要加上t1.来说明这是使用的t1文件执行结果为下面换种形式:
import t1from t1 import outout()t1.hello()
还可以使用另一种形式:
from t1 import *out()hello()
注意此时前面不能加上t1.。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: