我有这段丑陋的代码..
orders = got_something_from_db()
if orders:
for order in orders:
#print order
event_id = order["event_id"]
if event_id in event_id_dict: # something i grabbed earlier
product_id = order["product_id"] # products in an event
qty = order["qty"]
if product_id in product_sku_dict:
sku_id =product_sku_dict[product_id]
for i in range(qty):
sku_ids.append(sku_id)
我如何使这个更pythonic(和简洁)