How to split a string into a list with Python

1 Answer

0 votes
s = "python-java-c++-php"
   
lst = s.split('-') 
  
print(lst)

 
  
 
'''
run:
 
['python', 'java', 'c++', 'php']
 
'''

 



answered Dec 28, 2019 by avibootz

Related questions

2 answers 240 views
2 answers 273 views
1 answer 274 views
2 answers 229 views
2 answers 188 views
...