Converting tuple to String

Stefan Lang langstefan at gmx.at
Sun Apr 30 11:50:33 EDT 2006


On Sunday 30 April 2006 17:32, Byte wrote:
> Is their a command to convert a tuple to string? e.g.
>
> xyz = "Hello", "There"
> print xyz
>
> Is their any way of getting print to see xyz as being one string
> i.e. "Hello There" rather than "Hello" and "There", despite "Hello"
> and "There" being, in reality, seperate?

Use the "join" method of strings:

  print ' '.join(xyz)

-- 
Stefan



More information about the Python-list mailing list