Skip to content
Discussion options

You must be logged in to vote

uctypes appears to work perfectly for this.

>>> import uctypes
>>> data = bytearray(4)
>>> data
bytearray(b'\x00\x00\x00\x00')
>>> s = uctypes.struct(uctypes.addressof(data), {'f32': uctypes.FLOAT32})
>>> s.f32
0.0
>>> s.f32 = 1.4
>>> data
bytearray(b'33\xb3?')

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

andrewleech
Oct 8, 2023
Collaborator Sponsor

You must be logged in to vote
1 reply
@a-tarasov7
Comment options

Answer selected by a-tarasov7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants