modules and packages

1  # web->web1->web2->cal has a def add(x,y):return x+y 
2  # from web.web1.web2 import cal 
3  # from web,web1.web2.cal import add 
4  # There is an __init__ file under web2. If from . import cal is written in the file, you can call the following 
5  # from web.web1 import web3 call and execute web3 
6  if  __name__ == ' __main__ ' :         #Used for the called file 
7      print ( ' hello world ' )

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324732228&siteId=291194637