Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python for loop index

# Creates two variables; An index (num), and the value at that index (line)
for num, line in enumerate(lines):
    print("{0:03d}: {}".format(num, line))
Source by treyhunner.com #
 
PREVIOUS NEXT
Tagged: #python #loop #index
ADD COMMENT
Topic
Name
2+9 =