how to remove the first value in a list python code example

Example 1: python remove first item in tuple

# By definition, tuple object is immutable. 
# Hence it is not possible to remove element from it. 
# However, a workaround would be convert tuple to a list, 
# remove desired element from list and convert it back to a tuple.

T1=(1,2,3,4)
L1=list(T1)
L1.pop(0)
T1=tuple(L1)
print(T1)	# (2, 3, 4)

Example 2: python remove first element from list

>>> l = [1, 2, 3, 4, 5]
>>> l
[1, 2, 3, 4, 5]
>>> l.pop(0)
1
>>> l
[2, 3, 4, 5]

Example 3: remove first member from list

# 0 is the member you want to remove
list.pop(0)

Example 4: remove first item from list python

>>> l = ['a', 'b', 'c', 'd']
>>> l.pop(0)
'a'
>>> l
['b', 'c', 'd']
>>>