Re: Converting a List into a String

2005-11-05 Thread [EMAIL PROTECTED]
''.join['h','i']

[EMAIL PROTECTED] wrote:
 I have a List

 list = ['f', 'e', 'd', 'c', 'b', 'a']

 How can i convert it into a string so the output is

 fedcba

 i used

 for a in list:
   print a,

 the output is

 f e d c b a

 How can i remove the spaces b/w each letter?
 --
  * Posted with NewsLeecher v3.0 Beta 7
  * http://www.newsleecher.com/?usenet

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Converting a List into a String

2005-11-05 Thread Will McGugan
[EMAIL PROTECTED] wrote:
 I have a List
 
 list = ['f', 'e', 'd', 'c', 'b', 'a']
 
 How can i convert it into a string so the output is
 
 fedcba
 
 i used
 
 for a in list:
   print a,
 
 the output is 
 
 f e d c b a
 
 How can i remove the spaces b/w each letter?

print .join(list)

BTW list isnt a good name for a list, it hides the built in type.


Will McGugan
-- 
http://www.willmcgugan.com
.join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in 
jvyy*jvyyzpthtna^pbz)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Converting a List into a String

2005-11-05 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote:
 list = ['f', 'e', 'd', 'c', 'b', 'a']
 
 How can i convert it into a string so the output is
 
 fedcba

print ''.join(list)
-- 
http://mail.python.org/mailman/listinfo/python-list