1

Could any one help me to implement C structure data type in python? I need a similar structure data type in python as below.

struct msgbuf
{
   long mtype;
   char mtext[100];
};
Eraklon
  • 4,206
  • 2
  • 13
  • 29
Winner
  • 23
  • 4
  • 3
    Does this answer your question? [C-like structures in Python](https://stackoverflow.com/questions/35988/c-like-structures-in-python) – subdeveloper Feb 24 '20 at 09:49
  • See if named tuples are what you need: https://stackoverflow.com/questions/2970608/what-are-named-tuples-in-python – Łukasz Ślusarczyk Feb 24 '20 at 09:56
  • That's what named tuples are for. http://docs.python.org/dev/library/collections.html#namedtuple-factory-function-for-tuples-with-named-fields – Vishnu CS Feb 24 '20 at 14:03

0 Answers0