Is x = b'ABC' equivalent to x='ABC'.encode("ascii") in Python 3.5? Are there any differences between these two methods.
They produce the same result:
>>> 'ABC'.encode("ascii")
b'ABC'
>>> b'ABC'
b'ABC'
However encode() will call the encoder at runtime, instead of at compile time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With