Answers for "how to strip and split a string into individual words python"

10

python split sentence into words

sentence = 'Hello world a b c'
split_sentence = sentence.split(' ')
print(split_sentence)
Posted by: Guest on October-12-2020
0

strip in split python

my_string = "blah, lots  ,  of ,  spaces, here "
result = [x.strip() for x in my_string.split(',')]
# result is ["blah", "lots", "of", "spaces", "here"]
Posted by: Guest on December-16-2020

Code answers related to "how to strip and split a string into individual words python"

Python Answers by Framework

Browse Popular Code Answers by Language