Search notes:

Python standard library: binascii

a2b_base64() Built-in function
a2b_hex() Built-in function
a2b_qp() Built-in function
a2b_uu() Built-in function
b2a_base64() Built-in function
b2a_hex() Built-in function
b2a_qp() Built-in function
b2a_uu() Built-in function
crc32() Built-in function
crc_hqx() Built-in function
__doc__ str object
Error binascii.Error class
hexlify() Built-in function
Incomplete binascii.Incomplete class
__loader__ _frozen_importlib.BuiltinImporter class
__name__ str object
__package__ str object
__spec__ ?
unhexlify() Built-in function

Base 64 encoding/decoding

b2a_base64 converts a bytes object to a Base64 representation.
a2b_base64 does the opposite.
>>> import binascii
>>> print(binascii.b2a_base64(b'hello world', newline=False).decode('ascii'))
aGVsbG8gd29ybGQ=
>>> print(binascii.a2b_base64(b'aGVsbG8gd29ybGQ=').decode('ascii'))
hello world

Convert bytes to hexadecimal representation and vice versa

>>> binascii.hexlify(b'Rene\x17')
b'52656e6517'
>>> binascii.unhexlify(b'52656e6517')
b'Rene\x17'
Note that hexlify() returns a bytes object.
A string object can be obtained by directly calling .hex() on the bytes object:
>>> b'ABC'.hex()
'414243'

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:51 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(51): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(66): id_of(Object(PDO), 'uri', '/notes/developm...') #2 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758198567, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #3 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Python/standard-library/binascii(82): insert_webrequest() #4 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 51