How to split a string by one or more spaces in Python

1 Answer

0 votes
string = 'python         java  c++ c         go'

lst = string.split()

print(lst)

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

'''
 

 



answered Jul 26, 2022 by avibootz

Related questions

1 answer 195 views
1 answer 174 views
2 answers 235 views
1 answer 149 views
1 answer 97 views
1 answer 174 views
1 answer 115 views
...