Comment on multiple lines and Python [duplicate id error]
this question already has answers here :
is there any way to comment multiple lines in Python?
(4 responses)
Closed last year .
I was writing my code and needed to block a few lines of code. As there are several, I decided to use the 3 quotes to block a part of the code.
However, when I squeegee the code it shows indentation error. Does anyone know what I've been doing wrong?
I've noticed that when I put # this indentation error does not happen.
1
Author: Matheus Pena, 2020-02-04
1 answers
In Python the only thing made to comment code is #
, what you are doing using '''
is just a string Literal, that is, a docstring
, the same serves to comment, but it must also be idented, as in the example:
def funcao():
'''
comentários aqui
'''
print("vai printar")
It is worth remembering that this serves other things as well, for example if you go in an IDE and Type help(funcao)
, what would be shown would be:
'comentários aqui'
I pretty much translated that answer for you.
0
Author: FourZeroFive, 2020-02-04 14:39:54