Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagepy
>>> a = "hello"
>>> b = b"hello"

>>> type(a), type(a.encode("utf8"))
(<class 'str'>, <class 'bytes'>)
>>> type(b), type(b.decode("utf8"))
(<class 'bytes'>, <class 'str'>)

str.encode() => bytes
bytes.decode() => str

速记

Unicode => Str => Bytes,简称USB……