How do I converted a null (0) terminated string to a Python string?

John Machin sjmachin at lexicon.net
Thu Sep 14 05:20:34 EDT 2006


Fredrik Lundh wrote:
> Michael wrote:
>
> > Thanks for your reply. Just wondering... how are Python strings
> > formatted? Evidently they're not 0 terminated.
>
> have you tried *printing* the thing you got via UDP?
>
> to get a programmer-friendly representation of an arbitrary object, use
>
>      print repr(obj)
>
> (where obj is your string, in this case).
>

Probably not; there was no indication after the two messages where I
mentioned repr :-)




More information about the Python-list mailing list