python - how do i create a two list from a list inside of an array? -
python - how do i create a two list from a list inside of an array? -
so have next code:
thing = [ ['promotion not applied', 'buy1, 1 for $4.50', '(', 'details', ')'], [], ['promotions applied:', 'buy 1, 1 $4.50', '(', 'details', ')'] ]
so loops through list , want create 2 new lists promo_applied , promo_not applied:
so homecoming be:
promo_applied=["promotions applied", 'buy1, 1 for $4.50'] promo_not_applied = ["promotion not applied", 'buy1, 1 for $4.50']
thing = [ ['promotion not applied', 'buy1, 1 for $4.50', '(', 'details', ')'], [], ['promotions applied:', 'buy 1, 1 $4.50', '(', 'details', ')'] ] promo_applied, _, promo_not_applied = map(lambda s:s[:2], thing)
python
Comments
Post a Comment