Код: Выделить всё
def get_items():
items = None
# Some logic here that might fail to populate `items`
return items
for item in get_items():
print(item)
Подробнее здесь: https://stackoverflow.com/questions/792 ... -in-python
Код: Выделить всё
def get_items():
items = None
# Some logic here that might fail to populate `items`
return items
for item in get_items():
print(item)