By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,932 Members | 1,944 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,932 IT Pros & Developers. It's quick & easy.

Concatenating/Appending the list of elements

100+
P: 440
Hi

Is it possible to Concatenate/Append list of elements into a single string as shown below ?

I/P:

list = ['ID','1','1','2']

O/P:

'ID112'

I dont want to travese the individual element by element in a list and concatenate the string to get the final string

-PSB
May 1 '07 #1
Share this Question
Share on Google+
2 Replies


100+
P: 440
If not list,is it possible with strings to ge the output?.

-PSB
May 1 '07 #2

bvdet
Expert Mod 2.5K+
P: 2,851
Hi

Is it possible to Concatenate/Append list of elements into a single string as shown below ?

I/P:

list = ['ID','1','1','2']

O/P:

'ID112'

I dont want to travese the individual element by element in a list and concatenate the string to get the final string

-PSB
Expand|Select|Wrap|Line Numbers
  1. >>> s = ['ID','1','1','2']
  2. >>> ''.join(s)
  3. 'ID112'
  4. >>> 
May 1 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.