Python For Looping Through a String
Looping Through a String
Even strings are iterable objects, they contain a sequence of characters:
Example
Loop through the letters in the word "banana":
for x in "banana":
print(x)
Try it Yourself »
Even strings are iterable objects, they contain a sequence of characters:
Loop through the letters in the word "banana":
for x in "banana":
print(x)
Try it Yourself »
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
help@w3schools.com
Your message has been sent to W3Schools.