python multiple line comment code example
Example 1: python if statement multiple lines
# ex. 1
if (cond1 == 'val1' and cond2 == 'val2' and
cond3 == 'val3' and cond4 == 'val4'):
do_something
# Also, don't forget the whitespace is more flexible than you might think:
# ex. 2
if (
cond1 == 'val1' and cond2 == 'val2' and
cond3 == 'val3' and cond4 == 'val4'
):
do_something
if (cond1 == 'val1' and cond2 == 'val2' and
cond3 == 'val3' and cond4 == 'val4'):
do_something
Example 2: python comments
# this is a comment
# Python ignores comments,
something = 1 # and you can place them after any line of code
"""If you don't want to write a comments using hashtags,
you can put them in a multi-line comment block.
However, if you put hashtags in strings, they do not
create comments.
"""
# comments serve as notes to the programmers
# you can write whatever you want in comments
Example 3: multiline comment python
# While Python doesn't support multi-line comments, it can ignore anything
'''
inside a multi-line string!
Just wrap the comment in the three single quote marks,
And
you're
good
to
go!
'''
Example 4: python comment multiple lines
#There is no way to comment multiple lines in Python.
#You just keep using "#" symbol to comment each line out.
'''
Technically you could also use triple single quotation
marks like so, but this formatting does not count
as "true" source code comments that are removed by
a Python parser.
'''
Example 5: comment multiple lines in python shortcut
Ctrl+/
For Both:
Ctrl+K+C
to comment
Ctrl+K+U
To uncomment
Example 6: multiline comment python
# Python doesn't support multi-line comment blocks out of the box.
# The recommended way to comment out multiple lines of code in Python is
# to use consecutive single-line comments.
# feelsbadman