Advertisement
Guest User

Untitled

a guest
Apr 16th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1.  
  2. small_dict = {"a":"1"}
  3. full_dict = {"a":"1", "b":"test", "c":["junk"]}
  4.  
  5. template = {"a":int, "c":list}
  6.  
  7. def check(incoming_args, template):
  8.     res = {}
  9.     for key in template:
  10.         if key in incoming_args:
  11.             res[key] = template[key](incoming_args[key])
  12.     return res
  13.  
  14. print check(small_dict, template)
  15. print check(full_dict, template)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement