Concatenating/Appending the list of elements

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • psbasha
    Contributor
    • Feb 2007
    • 440

    Concatenating/Appending the list of elements

    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
  • psbasha
    Contributor
    • Feb 2007
    • 440

    #2
    If not list,is it possible with strings to ge the output?.

    -PSB

    Comment

    • bvdet
      Recognized Expert Specialist
      • Oct 2006
      • 2851

      #3
      Originally posted by psbasha
      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
      Code:
      >>> s = ['ID','1','1','2']
      >>> ''.join(s)
      'ID112'
      >>>

      Comment

      Working...