How to separate the first word from a string into a list with Python

1 Answer

0 votes
s = "python programming language"
  
lst = s.split(' ', 1) 
                      
print(lst)  

         
      
'''
run:
 
['python', 'programming language']
      
'''

 



answered Apr 23, 2020 by avibootz
...