ctypes is a foreign function interface module for Python, which allows you to load in dynamic libraries and call C functions.
This is not technically extending Python, but it serves one of the primary reasons for extending Python: to interface with external C code.
import ctypes
# unter Windows:
# libc = ctypes.CDLL("MSVCRT")
# unter Linux:
libc = ctypes.CDLL("libc.so.6")
libc.printf(b"Hallo Welt\n")
#libc.printf("Hallo Welt\n") Python2
x = libc.rand();
print(x)
x = libc.putchar(48);
Muss groß geschrieben werden und ohne .dll