Python Exercise Example 33
**Question:** Separate a list by commas.
**Analysis:** None.
Example (Python 2.0+)
#!/usr/bin/python
-- coding: UTF-8 --
L
=
[
1
,
2
,
3
,
4
,
5
]
s1
=
'
,
'
.
join
(
str
(
n
)
for
n
in
L
)
(
s1
)
The output of the above example is:
1,2,3,4,5
Python 100 Examples