I have a list and I am trying to remove the first item in it
I have tried to use this code, but it doesn't do anything
del rows[rows.index(userInfo)][9].split()[0]
for context
rows[rows.index(userInfo)][9].split()
finds an item in a list which is a string then splits the string into a list, this string is
Skyfall Skyfall DarkKnight DieHard CaptainAmerica Deadpool TheMatrix CaptainAmerica TheMatrix CaptainAmerica TheBourneIdentity
You can use pop()
or index it out with slicing like this:
rows[rows.index(userInfo)][9] = " ".join(rows[rows.index(userInfo)][9].split().pop())
or
rows[rows.index(userInfo)][9] = " ".join(rows[rows.index(userInfo)][9].split()[1:])