sizeof() in python

Gabriel Genellina gagsl-py2 at
Tue Jun 19 06:54:05 CEST 2007

En Tue, 19 Jun 2007 00:20:02 -0300, Alvin Delagon <adelagon at>  

> Is there a way to know the size of data in python? Like a sizeof feature  
> in
> C? I need this because I have to make a python application that will send
> packets at 1-2 kilobytes/sec via UDP. Thank you in advance guys.

So you don't need the size of arbitrary data, only the size of your  
packets. Assuming you use strings (perhaps built using struct.pack) just  
use len(a_string).

Gabriel Genellina

More information about the Python-list mailing list