i have this code :
t = { u'last_name': [u'hbkjh'], u'no_of_nights': [u'1'], u'check_in': [u'2012-03-19'], u'no_of_adult': [u'', u'1'], u'csrfmiddlewaretoken': [u'05e5bdb542c3be7515b87e8160c347a0'], u'memo': [u'kjhbn'], u'totalcost': [u'1800.0'], u'product': [u'4'], u'exp_month': [u'1'], u'quantity': [u'2'], u'price': [u'900.0'], u'first_name': [u'sdhjb'], u'no_of_kid': [u'', u'0'], u'exp_year': [u'2012'], u'check_out': [u'2012-03-20'], u'email': [u'ebmalifer@agile.com.ph'], u'contact': [u'3546576'], u'extra_test1': [u'jknj'], u'extra_test2': [u'jnjl'], u'security_code': [u'3245'], u'extra_charged': [u'200.0']}
{k: v for k,v in t.iteritems() if k.startswith('extra_')}
it gives me the output of :
{u'extra_charged': [u'200.0'], u'extra_test1': [u'jknj'], u'extra_test2': [u'jnjl']}
is it possible that i can clean the output or remove the first u, [, ],?
just like this…
{'extra_charged': '200.0', 'extra_test1': 'jknj', 'extra_test2': 'jnjl'}
1 Answer