문제

I'm coding an __init__() function but I have an error which is: Expected:), and further there is: Undefined variable: self

I really don't understand why I got this, can you help me?

My code:

class PVT_frame:
"Definition of PVT frame"

    def __init__(self, data_rmc['year'], ... ):

        ###TIME VALUES
        self.year = data_rmc['year']
        self.month = data_rmc['month']
        self.day = data_rmc['day']
        ...

Thank you in advance.

도움이 되었습니까?

해결책

Indent your code and everything will be fine.

class PVT_frame:
    """Definition of PVT frame"""

    def __init__(self, data_rmc, *args):
        self.year = data_rmc['year']
        self.month = data_rmc['month']
        self.day = data_rmc['day']

Another thing, use triple double quotes for doc string.

다른 팁

  1. Indent your code correctly.
  2. Use def __init__(self, data_rmc):
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top