Advertisement
here2share

# extract_img_hw_sort.py

Mar 5th, 2019
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.98 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. # extract_img_hw_sort.py
  3.  
  4. import random
  5.  
  6. ppp='''
  7. ABC123 great +++ Y2K ??? abc 001 $$$ 1920 X 1080 XYZ123 !!! ### yes 250 XXX
  8. 1440 X 960 ### WOW! Python xyz 250 $$$ !!! ??? great
  9. zzz demo XXX abc *** hello 800 X 1200
  10. 123 100 250 $$$ hello XYZ123 great +++ abc 1280 X 1024 zzz
  11. test abc *** yes Y2K ### 854 X 1280
  12. 250 test 123 xyz Python 2560 X 1440 +++ ### !!! 100 zzz ABC123 hello 099
  13. 1600 X 1200 123 099 $$$ Python abc great ABC123 *** hello +++ Y2K
  14. ??? demo xyz great ### ABC123 3000 X 2000 +++ XYZ123 test WOW! 001 haha XXX 123 Python
  15. XXX zzz 1080 X 1200 Python $$$ 123 ABC123 hello 250 ###
  16. 099 +++ zzz 900 X 900 100 ABC123 ### test *** xyz 250
  17. '''.strip().splitlines()
  18.  
  19. zzz=[]
  20. for z in ppp:
  21.     if 'X' in z:
  22.         print z
  23.         z=z.split()
  24.         x=z.index('X')
  25.         z=[int(z[x-1]),int(z[x+1])]
  26.         zzz.append(z)
  27.         print z
  28.         print
  29.  
  30. for z in range(len(zzz)-1,0,-1):
  31.     if zzz.count(zzz[z]) > 1:
  32.         del zzz[z]
  33. zzz.sort(key=lambda zzz: zzz[1])
  34.  
  35. for z in zzz[::-1]: print z
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement