返回顶部

收藏

Import a specific member from a module

更多
#//File: module1.py

def printer(x):           # module attribute
    print x

#/////////////////////////////////////////////////////////////////////////////
#//Main.py

from module1 import printer       # copy out one variable
printer('Hello world!')           # no need to qualify name

标签:Python,基础

收藏

0人收藏

支持

0

反对

0

»更多 您可能感兴趣的代码
  1. 2012-11-05 21:59:42java获得随机数代码 by 怪兽狂殴奥特曼
  2. 2014-12-07 11:56:08Logistic Regression by wubai
  3. 2015-12-12 12:33:52Print module infomation by 大猪
  4. 2016-01-31 20:35:56Define and use Module: import by wubai
  5. 2016-02-14 09:34:09While with break by 风云轩
  6. 2016-03-13 14:57:35For loop combined with in function by 司马
  7. 2016-03-20 11:47:55Cheap and simple API helper by Solon.Ring
  8. 2016-04-23 15:49:53Comment in Python by 张宋付
  9. 2016-05-30 19:26:39Demonstrates random number generation by 司马
  10. 2016-08-19 18:58:38Link Python system error stream into a file by 阿明娃儿
  11. 2016-10-13 09:08:26Calculating compound interest. by 风云轩

发表评论