Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

access key and value when looping over lists in Python

# Python3 code to iterate over a list
list = [1, 3, 5, 7, 9]
   
# Using enumerate() 
for i, val in enumerate(list):
    print (i, ",",val)
Comment

key item loop list python

for index, item in enumerate(list):
	print index
	print item
Comment

PREVIOUS NEXT
Code Example
Python :: python logging to console exqmple 
Python :: python integer validation 
Python :: sacar la posicion en una lista python 
Python :: Python Split list into chunks using List Comprehension 
Python :: python read word document 
Python :: ax set xtick size 
Python :: how to launch jupyter notebook from cmd 
Python :: create list in range 
Python :: how to filter out all NaN values in pandas df 
Python :: how to make all time greeter using python 
Python :: phi 
Python :: how to clear screen python 
Python :: sqlalchemy delete by id 
Python :: flask define template folder 
Python :: adaptive thresholding with opencv python 
Python :: python pickle example 
Python :: dropping unnamed columns in pandas 
Python :: install chromedriver ubuntu python 
Python :: convert files from jpg to png and save in a new directory python 
Python :: python yaml parser 
Python :: polarean share price 
Python :: raw string 
Python :: pandas open text file 
Python :: chrome selenium python 
Python :: save pandas into csv 
Python :: python for loop with array 
Python :: python poner en mayusculas 
Python :: make csv lowercase python 
Python :: reduce in python 
Python :: json load python 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =