簡體   English   中英

我不斷收到此錯誤:這是什么意思? NameError:未定義名稱“ UniversityPerson”

[英]i keep getting this error: what Does it mean? NameError: name 'UniversityPerson' is not defined

import sys

class UniversityPerson:


 class Student(UniversityPerson):


    def _init_(self, schedule):

為什么要在UniversityPerson內部定義班級Student 使它們處於同一級別:

class UniversityPerson:
    pass

class Student(UniversityPerson):
    def __init__(self, schedule): #use double-underscores instead of single ones
        pass

您不必在調用它之前定義它並對其進行初始化嗎? 也許此鏈接有所幫助: Python類定義-import語句

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM