Skip to content Skip to sidebar Skip to footer

How To Convert Python Integers Into C Integers?

How tThere are many threads about going from a c language integer to python integer, but none that i can find vice versa. I am using a native c library, opengl, ported into python

Solution 1:

I would suggest using the python struct library.

fromstruct import *
struct('i', 66)

b'B\x00\x00\x00'

https://docs.python.org/3/library/struct.html#format-strings Read up on how to format you data types.

Post a Comment for "How To Convert Python Integers Into C Integers?"