[issue42876] '''"""''' != '""""'

Eryk Sun report at bugs.python.org
Sat Jan 9 14:20:54 EST 2021


Eryk Sun <eryksun at gmail.com> added the comment:

> assert '''"""''' == '""""'  # Fails

The left-hand side is a triple-quote string literal [1][2] that contains 3 double-quote characters. The right-hand side is a single-quote string literal that contains 4 double-quote characters. Use the interactive shell to check the values. For example:

    >>> list('''"""''')
    ['"', '"', '"']

    >>> list('""""')
    ['"', '"', '"', '"']

If you have difficulty understanding an aspect of the language syntax, please ask a question in an appropriate forum such as python-tutor, python-list, or Stack Overflow.

---

[1] https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals
[2] https://docs.python.org/3/tutorial/introduction.html#strings

----------
nosy: +eryksun
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42876>
_______________________________________


More information about the Python-bugs-list mailing list