Re: Converting tuple to String
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: Converting tuple to String

From: Stefan Lang <langstefan@gmx.at>
Date: Sun Apr 30 2006 - 17:50:33 CEST

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
Received on Mon May 1 00:47:30 2006