Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Python List Elements

my_list = ['p', 'r', 'o', 'b', 'e']
# first item
print(my_list[0])  # p
# third item
print(my_list[2])  # o
# fifth item
print(my_list[4])  # e
# Nested List
n_list = ["Happy", [2, 0, 1, 5]]
# Nested indexing
print(n_list[0][1])
print(n_list[1][3])

# Error! Only integer can be used for indexing
print(my_list[4.0])
Comment

PREVIOUS NEXT
Code Example
Python :: qtablewidget clear python 
Python :: python find equal rows of two numpy arrays 
Python :: or in django query 
Python :: how to use cv2.COLOR_BGR2GRAY 
Python :: how to create dictionary between two columns in python 
Python :: python find largest variable 
Python :: python remove all elemnts in list containing string 
Python :: python one line if statement without else 
Python :: fcm_django 
Python :: while loop python 
Python :: python string isdecimal 
Python :: virtualenv specify python version 
Python :: select realted for foreign key table in django 
Python :: install python in docker file 
Python :: groupby and sort python 
Python :: scikit learn pca 
Python :: remove character(s)from each column in dataframe 
Python :: how to check if a file exists in python 
Python :: how to remove quasi constant column in pandas dataframe 
Python :: python is folder or file 
Python :: opencv shift image python 
Python :: requests save data to disk 
Python :: how to bulk update in mongodb using python 
Python :: python run command 
Python :: how to colour letters in python 
Python :: django migrate model 
Python :: python turtle spiral 
Python :: python working directory 
Python :: tkinter filedialog get directory path 
Python :: escape character in python 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =