We have a list item_list
,
item_list = ["a", "b", "XYZ", "c", "d", "e", "f", "g"]
We iterate over its items with a for loop, if item is "XYZ"
, skip items "c", "d", "e"
and continue with "f"
:
for item in item_list:
if item == "XYZ":
do_something()
skip_3_items() ----> skip items "c", "d", "e"
else:
do_something_else()
What could be the most pythonic way to achieve this?