Advertisement
Guest User

Untitled

a guest
Aug 24th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. dec_box = [[127.46659851074219, 697.761474609375, 592.3056030273438, 969.1796264648438], [145.38204956054688, 241.7072296142578, 552.0755615234375, 409.4161376953125], [709.1004638671875, 240.0570831298828, 1254.04150390625, 516.4016723632812], [1489.12451171875, 341.7560119628906, 2032.9217529296875, 631.8690185546875], [932.1668090820312, 742.7733764648438, 1454.72119140625, 1049.021484375]]
  2. num = ['three', 'one', 'five', 'zero', 'nine']
  3. ary2 = []
  4. for x in range(len(dec_box)):
  5. ary2.append(dec_box[x][1])
  6.  
  7. dict1 = {}
  8. for x in range(len(dec_box)):
  9. dict1[ary2[x]] = num[x]
  10.  
  11. ary2.sort()
  12. # print(ary2)
  13. dict2 = {}
  14. for x in range(len(dec_box)):
  15. dict2[dict1[ary2[x]]] = ary2[x]
  16. dict3 = []
  17. for x in dict2:
  18. if x == "one":
  19. dict3.append(1)
  20. elif x == "two":
  21. dict3.append(2)
  22. elif x == "three":
  23. dict3.append(3)
  24. elif x == "four":
  25. dict3.append(4)
  26. elif x == "five":
  27. dict3.append(5)
  28. elif x == "siz":
  29. dict3.append(6)
  30. elif x == "seven":
  31. dict3.append(7)
  32. elif x == "eight":
  33. dict3.append(8)
  34. elif x == "nine":
  35. dict3.append(9)
  36. elif x == "ten":
  37. dict3.append(10)
  38.  
  39. print(dict3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement