DEV Community

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

How to solve indentation error in python?

joshuabrown0010 profile image joshua-brown0010 ・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 is not 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 may be your docstring should be: ' Class for storing movie data

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

  • title,
  • story summary,
  • poster images,
  • profits,
  • ratings,
  • links to trailers on youtube `

Read more

Discussion (0)

pic
Editor guide