I am starting to learn Python. The python version I'm using is 3.2.1.1 I'm trying to learn ctypes following the tutorial from docs.python.org
in the online invitation
import ctypes
libc = cdll.msvcrt
printf = libc.printf
printf("%d", 42)
it should return 42 but in my case it returns 0. So what is the problem? Many thanks.
Now, after adding →> from ctypes import cdll, the result began to show this
>>>from ctypes import *
>>>libc = cdll.msvcrt
>>>printf = libc.printf
>>>printf("%d", 42)
Traceback (most recent call last):
File "<stdin>", line1, in <module>
TypeError: 'CDLL' object is not callable
user1393258
source
share