[0, 1, 2, 3, 4] -> [1, 2, 3, 4]
I'd like to remove the first element of the list together. Is there a function that does this? As I did, I don't think I need to use the for statement, but I don't know what function to use.
a = [0, 1, 2, 3, 4]
b = [i for i in a[1:]]
Remove the i
th item of s
and return the i
th item
>>> l = [0, 1, 2, 3, 4]
>>> l.pop(0)
0
>>> l
[1, 2, 3, 4]
Same as s[i:j] = []
>>> l = [0, 1, 2, 3, 4]
>>> del l[0]
>>> l
[1, 2, 3, 4]
l[1:]
copies from the second element of itable to return
>>> l = [0, 1, 2, 3, 4]
>>> l = l[1:]
>>> l
[1, 2, 3, 4]
© 2024 OneMinuteCode. All rights reserved.