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,354
  • 3
  • 18
  • 44

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
  • 33,740
  • 12
  • 54
  • 68