python----模块

模块

def test1():

    print("----recvmsg---test1-----")

def test1():

    print("-----test1----")

 

def test2():

    print("-----test2----")

#__开头 __结尾,一般都是系统的方法

if __name__ == "__main__":#这__name__非常的独特,不同的文件调用他,值不一样。当前文件调用他为__main__其他文件调用他为导入的文件名称

    test1()

    test2()

# from com.day11.module import sendmsg, recvmsg

# 从某个包,导入对应的模块

# sendmsg.test1()

# sendmsg.test2()

# recvmsg.test1()

 

 

from com.day11.module.sendmsg import test1, test2

from com.day11.module.sendmsg import test2

 

# 从包里面的某个模块导入方法(注意:后导入的将会把新导入的替换;比如test2)

# from sendmsg import *

# from recvmsg import *

 

test1()

test2()

如有疑问,请发邮件:[email protected]


github:https://github.com/wangrui0/
 

猜你喜欢

转载自blog.csdn.net/qq_35524586/article/details/86407031
今日推荐