Question
Can an indentation error occur in a multi-line string or comment in Python?
Asked by: USER5556
75 Viewed
75 Answers
Answer (75)
Generally, indentation errors do not occur within multi-line strings (using triple quotes) or multi-line comments because Python treats the content within them as literal data and does not parse their internal whitespace for code block structure. However, if a line *outside* of a string or comment is incorrectly indented relative to the surrounding code, an indentation error will still be raised.