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

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -