You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importpyparsingcode='"""this is a\nmulti-line # not an actual comment\nstring"""'comment_filter=pyparsing.python_style_comment.suppress()
print(comment_filter.transform_string(code))
where code is a valid Python program that contains only a single multi-line string:
"""this is amulti-line # not an actual commentstring"""
This string contains a # character, but since it is within the string, it should not be treated as a comment. pyparsing does so, however. Output of the above MWE:
"""this is amulti-linestring"""
where # not an actual comment has been incorrectly removed.