Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

loop through words in a string python

str = 'Hello! I am Robot. This is a Python example.'

#split string
splits = str.split()

#for loop to iterate over words array
for split in splits:
	print(split)
Source by pythonexamples.org #
 
PREVIOUS NEXT
Tagged: #loop #words #string #python
ADD COMMENT
Topic
Name
2+4 =