Home > Back-end >  Python - What is wrong with this fucniton declaration?
Python - What is wrong with this fucniton declaration?

Time:01-10

def convert(self, path: str):
                                     ^
SyntaxError: invalid syntax

i am getting a SyntaxError. I checked online and saw this is how it should be declared. what is wrong with this?

CodePudding user response:

if function defined it must have a code or pass instead when you don't want to implement code right now.

def foo():
   pass

or if you want to warn when function used

def foo():
    raise(Exception("NotImplemented"))

CodePudding user response:

there is nothing in your function just continue your code where I put print(). same with all others things like "if" and "for".

def convert(self, path: str):
    print()
  • Related