How to add multi-line comment section? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: How to add multi-line comment section? (/thread-41833.html) |
How to add multi-line comment section? - Winfried - Mar-24-2024 Edit (since this forum doesn't support deleting a thread): My mistake. After using the (shift+)TAB keys, the script runs. Guess there were useless TAB characters. ----------------- Hello, Is there a way to add a multi-line comment block that keeps Python happy? import glob for item in glob.glob("*.txt"): print(f"**************** Handling {item}") name = True if name: print("True1") else: print("False1") #=========== blah """ IndentationError: unindent does not match any outer indentation level some comment """ if name: print("True2") else: print("False2")Note: Unlike displayed above, in the source code, the block is at the same level as the two "if name" lines. Thank you. RE: How to add multi-line comment section? - deanhystad - Mar-24-2024
RE: How to add multi-line comment section? - sparklesclink - Jun-04-2024 The problems are really quite difficult. Thanks for sharing the information. RE: How to add multi-line comment section? - Gribouillis - Jun-04-2024 Many code editors have keyboard shortcuts to comment out a selected section of the code. For example in the Kate editor, Ctrl+D comments the selected portion of the code and Ctrl+Shift+D uncomments it. |