好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

python模块

模块:自我包含并且有组织的代码片段
导入(import):把其它模块中属性附加到你的模块的操作
imptee.py

Python代码

foo='abc'  
def show():  
    print 'foo from imptee:',foo  
impter.py 

Python代码

import imptee  
from imptee import foo,show  
show()  
foo = 123  
print 'foo from impter:',foo  
show()  
print 'imptee.foo:',imptee.foo  
foo from imptee: abc foo from impter: 123 foo from imptee: abc imptee.foo: abc 

查看更多关于python模块的详细内容...

  阅读:44次

上一篇: python点滴

下一篇:python常用函数