str.startswith() not working as I intended

前端 未结 5 1197
滥情空心
滥情空心 2021-01-29 11:13

I can\'t see why this won\'t work. I am performing lstrip() on the string being passed to the function, and trying to see if it starts with \"\"\". For some reason, it gets caug

5条回答
  •  醉话见心
    2021-01-29 11:43

    if not line_t.startswith('"""') or not line_t.startswith('#'):
    

    This if will always be satisfied -- either the line doesn't start with """, or it doesn't start with # (or both). You probably meant to use and where you used or.

提交回复
热议问题