b'…'
literals is required when calling printf
. import ctypes libc = ctypes.cdll.LoadLibrary("libc.so.6") chars_printed = libc.printf(b'num: %d, txt: %s\n', 42, b'Hello World')
import ctypes libc = ctypes.cdll.msvcrt chars_printed = libc.printf(b'num: %d, txt: %s\n', 42, b'Hello World')