Python bytes() built-in function

From the Python 3 documentation

Return a new “bytes” object which is an immutable sequence of integers in the range [...]. bytes is an immutable version of bytearray – it has the same non-mutating methods and the same indexing and slicing behavior.

Examples

>>> bytes(1)
# b'\x00'
>>> bytes(10)
# b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
>>> bytes(100)
# b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
...

Ups! Nothing here yet!

This is a great opportunity for you to collaborate! Hit the link at the end of this page and add some examples and a brief description. If you don't know where to start, the Python 3 documentation will lead you in the right direction.

Subscribe to pythoncheatsheet.org

A two times a month and bullshit free publication, full of interesting, relevant links.