SHARE
TWEET

Untitled

a guest Jan 18th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. users = {
  2.     1: {'state': 'apple', 'menu_id': 123, 'args':['some data']},
  3.     2: {'state': 'something', 'menu_id': 321}
  4.     3: {'state': 'banana', 'menu_id': 666, 'args':['trash', 'temporary']}
  5. }
  6.    
  7. s = users.copy()
  8. for k,v in obj.items(): v.pop('args', None)
  9.  
  10. s1 = {k: {'state': v['state'], 'menu_id':v['menu_id']} for k,v in users.items()}
  11.  
  12. s2 = {k: {p: q for p,q in v.items() if p != 'args'} for k, v in users.items()}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top