How to Iterate Characters of a String in Python


In this example we will show how to iterate the characters of a string in Python.

Source Code

my_str = 'python'
for x in my_str:
    print(x)

Output:

p
y
t
h
o
n
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments