DEV Community

loading...
Cover image for How to solve indentation error in python?

How to solve indentation error in python?

whataluckyguy profile image Lalit Kumar ・1 min read

All of your class contents (doc strings, methods, and class variable definitions) need to be indented to the same level.

Currently either :

The doc string above your def init is indented too far or
The init method isn’t indented enough
It is up to you to choose which one is right - but PEP8 would say that the doc string is indented too far.

BTW - The normal format for a doc string is :

1st line is a one line summary
then a blank line
and the rest of the docstring is a more details description of the class.
or

1st line is a one line summary
SO maybe your docstring should be :

"""
Class for storing movie data

This class is for storing a large amount of movie
data such as:
Read more

Discussion

pic
Editor guide