Python/문자열 구분자 Split 및 순회


>>> words = “This is random text we’re going to split apart”
>>> words2 = words.split(“ “)
>>> words2

[‘This’, ‘is’, ‘random’, ‘text’, ‘we’re’, ‘going’, ‘to’, ‘split’, ‘apart’]

>>> for word in words:
>>>     print (word)

This
is
random
text
we're
going
to
split
apart

이 글에는 0 개의 댓글이 있습니다.