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

java Multi query from Mysql using netbeans -

c# - DotNetZip fails with "stream does not support seek operations" -

c++ - StartServiceCtrlDispatcher don't can access 1063 error -