0

In languages like PHP we can do the following:

>>> echo "cat is"." not"." dead"
cat is not dead

>>> echo "cat is"/*." not"*/." dead"
cat is dead

What I have done on the second line is, commenting out a chunk of it using PHP's multi-line comment feature.

Please let me know how to do the same in Python without breaking the line of code into separate lines.

Thanks..!

1 Answers1

5

Generally, no. To keep old code around, duplicate the line, comment out one, and modify the other.

stolenmoment
  • 443
  • 3
  • 6
  • This question is already marked as duplicate. But for me, I think your solution works better than the solutions suggested here: https://stackoverflow.com/questions/5617159/mid-line-comment-in-python Thanks..! – Parakrama Dharmapala Sep 06 '21 at 20:51