everybody is making this way more complicated than it needs to be. storage = list[:list.index(O)] incidentally, "list" is the name of a type, so you might want to avoid using it as a variable name.