1

When should someone use ctypes.Structure and when should someone use struct.unpack?

In general, I use ctypes.Structure when I want to extract data from an embedded device that runs C. I would first extract the raw binary data from my embedded device and then use a cytpes.Structure that describes it. Using the structure I then have my data in the correct form.

Is using struct.unpack and ctypes.Structure equivalent?

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Har
  • 3,727
  • 10
  • 41
  • 75
  • Im wondering are there any downfalls for using it? – Har Nov 26 '20 at 20:38
  • Does this answer your question? [Python: Similar functionality in struct and array vs ctypes](https://stackoverflow.com/questions/52004279/python-similar-functionality-in-struct-and-array-vs-ctypes) – alex_noname Nov 27 '20 at 15:59

0 Answers0