Frage

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.

War es hilfreich?

Lösung

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.

Andere Tipps

  1. Indent your code correctly.
  2. Use def __init__(self, data_rmc):
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top