Python teilte den Satz in Wörter auf
sentence = 'Hello world a b c'
split_sentence = sentence.split(' ')
print(split_sentence)
Stormy Seal
sentence = 'Hello world a b c'
split_sentence = sentence.split(' ')
print(split_sentence)
text= "I am Batman"
splitted_text= text.split()
Print(splitted_text)
>>> mary = 'Mary had a little lamb'
>>> mary.split('a') # splits on 'a'
['M', 'ry h', 'd ', ' little l', 'mb']
>>> hi = 'Hello mother,\nHello father.'
>>> print(hi)
Hello mother,
Hello father.
>>> hi.split() # no parameter given: splits on whitespace
['Hello', 'mother,', 'Hello', 'father.']
>>> hi.split('\n') # splits on '\n' only
['Hello mother,', 'Hello father.']