class F:
def __init__(self):
print('hello china')
__init__ 是構造函數,初始化類,每當調用類的時候,就會自動執行這個函數
比如:執行 F() 的時候,會自動執行__init__函數,就會自動打印出“hello china”
class F:
def __init__(self):
print('hello china')
__init__ 是構造函數,初始化類,每當調用類的時候,就會自動執行這個函數
比如:執行 F() 的時候,會自動執行__init__函數,就會自動打印出“hello china”
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。