The Python Oracle

Converting int to bytes in Python 3

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Magic Ocean Looping

--

Chapters
00:00 Question
01:30 Accepted answer (Score 30)
02:14 Answer 2 (Score 337)
03:01 Answer 3 (Score 252)
03:25 Answer 4 (Score 51)
04:04 Thank you

--

Full question
https://stackoverflow.com/questions/2101...

Question links:
[Python 3 bytes formatting]: https://stackoverflow.com/q/15710515/554...
http://bugs.python.org/issue3982

Accepted answer links:
[Python 3.5+ introduces %-interpolation (]: https://docs.python.org/3.5/library/stdt...
[PEP 0461 -- Adding % formatting to bytes and bytearray]: https://www.python.org/dev/peps/pep-0461/
[what ]: https://stackoverflow.com/q/846038/4279

Answer 2 links:
[to_bytes]: https://docs.python.org/3/library/stdtyp...

Answer 3 links:
[docs state this]: http://docs.python.org/3.3/library/stdty...

Answer 4 links:
[struct's pack]: https://docs.python.org/2/library/struct...
[byte-order (big-endian)]: https://docs.python.org/2/library/struct...
[format character]: https://docs.python.org/2/library/struct...
[python 3]: https://docs.python.org/3/library/struct...
[unpack]: https://docs.python.org/2/library/struct...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #python3x

#avk47