dieses Posting Nur so kann ich später danach suchen, wie es immer mich zu Stumpf scheint:Unterdrückt/print ohne b‘Präfix für Bytes in Python 3
$ python3.2
Python 3.2 (r32:88445, Oct 20 2012, 14:09:50)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import curses
>>> print(curses.version)
b'2.2'
>>> print(str(curses.version))
b'2.2'
>>> print(curses.version.encode('utf-8'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'bytes' object has no attribute 'encode'
>>> print(str(curses.version).encode('utf-8'))
b"b'2.2'"
Als Frage: wie ein binäres drucken (bytes
) Zeichenfolge in Python 3, ohne die b'
Vorwahl?
verwandte: [? Wie Bytes in Python in eine Datei schreiben 3 ohne die Codierung zu wissen] (https://stackoverflow.com/q/ 4290716/4279) – jfs