Guest User

Untitled

a guest
Jun 25th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  1. from collections import OrderedDict
  2.  
  3. >>> d1 = {'properties': OrderedDict([('KAEK', 'str:12'),
  4. ... ('PROP_TYPE', 'str:4'),
  5. ... ('ORI_TYPE', 'int:1'),
  6. ... ('ORI_CODE', 'str:100'),
  7. ... ('DEC_ID', 'str:254'),
  8. ... ('ADDRESS', 'str:254'),
  9. ... ('NUM', 'str:9'),
  10. ... ('LEN', 'float:19.11'),
  11. ... ('AREA', 'float:19.11')]),
  12. ... 'geometry': 'Polygon'}
  13.  
  14. >>> d1 = d1['properties']
  15.  
  16. >>> d2 = {'properties': OrderedDict([('OBJECTID_1', 'int:9'),
  17. ... ('OBJECTID', 'int:9'),
  18. ... ('FID_PERIVL', 'int:9'),
  19. ... ('DESC_', 'str:254'),
  20. ... ('PROP_TYPE', 'str:4'),
  21. ... ('Shape_Leng', 'float:19.11'),
  22. ... ('Shape_Le_1', 'float:19.11'),
  23. ... ('Shape_Area', 'float:19.11'),
  24. ... ('PARCEL_COD', 'str:254'),
  25. ... ('KAEK', 'str:50'),
  26. ... ('NUM', 'int:4'),
  27. ... ('DEC_ID', 'int:4'),
  28. ... ('ADDRESS', 'int:4'),
  29. ... ('ORI_CODE', 'int:4'),
  30. ... ('ORI_TYPE', 'int:4')]),
  31. ... 'geometry': 'Polygon'}
  32.  
  33. >>> d2 = d2['properties']
  34.  
  35. >>> from pprint import pprint
  36. >>> pprint(d1)
  37. OrderedDict([('KAEK', 'str:12'),
  38. ('PROP_TYPE', 'str:4'),
  39. ('ORI_TYPE', 'int:1'),
  40. ('ORI_CODE', 'str:100'),
  41. ('DEC_ID', 'str:254'),
  42. ('ADDRESS', 'str:254'),
  43. ('NUM', 'str:9'),
  44. ('LEN', 'float:19.11'),
  45. ('AREA', 'float:19.11')])
  46. >>> pprint(d2)
  47. OrderedDict([('OBJECTID_1', 'int:9'),
  48. ('OBJECTID', 'int:9'),
  49. ('FID_PERIVL', 'int:9'),
  50. ('DESC_', 'str:254'),
  51. ('PROP_TYPE', 'str:4'),
  52. ('Shape_Leng', 'float:19.11'),
  53. ('Shape_Le_1', 'float:19.11'),
  54. ('Shape_Area', 'float:19.11'),
  55. ('PARCEL_COD', 'str:254'),
  56. ('KAEK', 'str:50'),
  57. ('NUM', 'int:4'),
  58. ('DEC_ID', 'int:4'),
  59. ('ADDRESS', 'int:4'),
  60. ('ORI_CODE', 'int:4'),
  61. ('ORI_TYPE', 'int:4')])
  62.  
  63. pprint(set.symmetric_difference(set(d1.items()), set(d2.items())))
  64. {('ADDRESS', 'int:4'),#somehow inform that this belongs to d2 and so on...
  65. ('ADDRESS', 'str:254'),#d1
  66. ('AREA', 'float:19.11'),#d1
  67. ('DEC_ID', 'int:4'),#d2
  68. ('DEC_ID', 'str:254'),
  69. ('DESC_', 'str:254'),
  70. ('FID_PERIVL', 'int:9'),
  71. ('KAEK', 'str:12'),
  72. ('KAEK', 'str:50'),
  73. ('LEN', 'float:19.11'),
  74. ('NUM', 'int:4'),
  75. ('NUM', 'str:9'),
  76. ('OBJECTID', 'int:9'),
  77. ('OBJECTID_1', 'int:9'),
  78. ('ORI_CODE', 'int:4'),
  79. ('ORI_CODE', 'str:100'),
  80. ('ORI_TYPE', 'int:1'),
  81. ('ORI_TYPE', 'int:4'),
  82. ('PARCEL_COD', 'str:254'),
  83. ('Shape_Area', 'float:19.11'),
  84. ('Shape_Le_1', 'float:19.11'),
  85. ('Shape_Leng', 'float:19.11')}
Add Comment
Please, Sign In to add comment