How are integers converted to bytes character sequences, such as 1-> bounded 1'?

such as the title.
I just want to use str to convert to a string, and then encode to convert to bytes:

>>> str(1).encode("utf-8")
b"1"

is there an easier way?

Mar.06,2021

looks like you're using python3, right?
you can use bytes (1) directly in python2, while in python3 you can also use bytes (str (1), 'utf8') . Manually funny:)

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3650d-2b84e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3650d-2b84e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?