Skip to content

Instantly share code, notes, and snippets.

@av1d
Created August 1, 2021 05:33
Show Gist options
  • Save av1d/9586c3b7768c0be475e1caa18127c71c to your computer and use it in GitHub Desktop.
Save av1d/9586c3b7768c0be475e1caa18127c71c to your computer and use it in GitHub Desktop.
Remove all items in a list before/up to a specific string
dataset = ['0','3','03','vm','00','a','7']
print("Unedited list: " + str(dataset))
vm_index = dataset.index("vm")
for number in range(len(dataset)):
dataset.pop(0)
if dataset[0] == "vm":
break
print("Edited list: " + str(dataset))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment