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 215 views
2 answers 246 views
1 answer 259 views
2 answers 219 views
2 answers 168 views
...