tuple to string?

Berthold Höllmann bhoel at despammed.com
Fri Jul 22 15:16:24 EDT 2005


Francois De Serres <fdeserres at gmx.net> writes:

> hiho,
>
> what's the clean way to translate the tuple (0x73, 0x70, 0x61, 0x6D)
> to the string 'spam'?

.>>> t = (0x73, 0x70, 0x61, 0x6D)
.>>> ''.join('%c' % c for c in t)
'spam'

-- 
"Es gelten die Regeln der christlichen Seefahrt: Rot und Grün markiert
 das sichere Fahrwasser, Schwarz und Gelb markieren Untiefen und
 Wracks."
Christa Sager, Bundestagsfraktionsvorsitzende Bündnis 90/Grüne



More information about the Python-list mailing list