Python: Iterate List

By Xah Lee. Date: . Last updated: .

Go Thru Values

aa = ["a", "b", "c"]

for xx in aa:
    print(xx)

# a
# b
# c

Go Thru Index and Value

bb = ["a", "b", "c"]

for ii, vv in enumerate(bb):
    print(ii, vv)

# 0 a
# 1 b
# 2 c

Python, Loop

Python, Data Structure