How to split comma-separated string in Python

1 Answer

0 votes
s = "python,java,c#,php,c++,c"

lst = s.split(',')

print(lst)

for item in lst:
    print(item)


'''
run:

['python', 'java', 'c#', 'php', 'c++', 'c']
python
java
c#
php
c++
c

'''

 



answered Nov 13, 2017 by avibootz

Related questions

...