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 199 views
1 answer 178 views
2 answers 242 views
1 answer 153 views
1 answer 104 views
1 answer 180 views
1 answer 120 views
...