There must already exist a gazillion articles about how to do this; but one more won’t hurt, right?
Suppose you have a list, called alist
, as the following:
In [2]: alist
Out[2]: ['apple', 'banana', 'pear']
To create a string from “alist” with a comma separator, we can do this:
In [3]: ','.join(alist)
Out[3]: 'apple,banana,pear'
Basically, you can place a desired separator in the ','
or omit it totally.