List to string separated by comma

/ Published in: Python
Save to your folder(s)

Copy this code and paste it in your HTML
  1. L = [1,2,3,4,5]
  2. s1 = ','.join(str(n) for n in L)
  3. s1
  4. '1,2,3,4,5'

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.