Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. print("rv --->", type(rv)) # <class 'ValueResult'> returned from database
  2. print("rv.value --->", type(rv.value)) # <class 'dict'>
  3. # shows {'ACTION_CODE': 'S', 'ARRIVAL_DATE': '03-JUL-19', 'BIT_FLAGS': '1082131456'
  4. print(rv.value)
  5. print("rv.value.items() ---> ", type(rv.value.items())) #<class 'dict_items'>
  6. print(json.loads(json.dumps(rv.value))) # used this no help
  7.  
  8. [
  9. {"ACTION_CODE": "S"},
  10. {"ARRIVAL_DATE": "03-JUL-19"} ,
  11. {"BIT_FLAGS": "1082131456" }
  12. ]
  13.  
  14. a={'ACTION_CODE': 'S', 'ARRIVAL_DATE': '03-JUL-19', 'BIT_FLAGS': '1082131456'}
  15. print([ {key:value} for key,value in a.items()])
  16.  
  17. [{'ACTION_CODE': 'S'}, {'ARRIVAL_DATE': '03-JUL-19'}, {'BIT_FLAGS': '1082131456'}]
  18.  
  19. x ={'ACTION_CODE': 'S', 'ARRIVAL_DATE': '03-JUL-19', 'BIT_FLAGS': '1082131456'}
  20. [{list(x.keys())[i]:list(x.values())[i]} for i in range(len(x))]
  21.  
  22. [{'ACTION_CODE': 'S'},
  23. {'ARRIVAL_DATE': '03-JUL-19'},
  24. {'BIT_FLAGS': '1082131456'}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement