1

I have a simple list

li=['beststreet','borocd']

print "I like strings a lot {}".format(li)

I want to format the list into a string but I want the output to be like this:

I like strings a lot beststreet,borocd

background: this is a simple example, I am doing string manipulation in a Class to be inserted into a SQL table...

ziggy
  • 1,488
  • 5
  • 23
  • 51

1 Answers1

2

Just join the strings in the list with a comma:

li=['beststreet','borocd']

print "I like strings a lot {}".format(‘,’.join(li))
quamrana
  • 37,849
  • 12
  • 53
  • 71