jeapedu 121~124 模塊

2019-04-14 16:10发布

链接: https://pan.baidu.com/s/1Pb01gfw_6h0bLNS_ZbAujQ 密码: ipmi import random x = random.randint(1, 10) print(x) import am z = am.add(19, 11) print("testam z", z) ## 122 模塊pyc文件 # import後,自動生成pyc文件 ## 123 模塊自測 import amc z = amc.add(19, 11) print("using testam z", z) ## 124 模塊配置問題 import sys print(sys.path) #sys.path.append(r'c:python27s') import amc import addminus as amd z = amd.add(20, 19) print(z) amd.pprint() amd.xprint() addminus.py def add(x, y): return x + y def minus(x, y): return x - y def pprint(): print("who is called me?") def xprint(): print("who is called me?") if __name__ == '__main__': print("testing my module") z = add(10, 11) print("in amc test", z) if __name__ == 'amc': pass #print("some using amc module")