Python的模块引用和查找路径(3)

>>> import person
This person
__init__
This pet
>>> dir(person)
['ID', '__builtins__', '__doc__', '__file__', '__name__', '__package__', 'have',
 'name', 'pet', 'pet_name', 'pet_run', 'say']
>>> print person.pet_name
This pet
>>> person.pet_run("nowhere")
This pet runs nowhere
>>>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/297857a8c9e7f4c5d0be7949ac5d0c25.html