Reputation: 64793
A 3rd party app saves images in such naming format where q85 is the quality, AAxBB means width and height:
62620587b.jpg.122x132_q85.jpg -> 122x132
62620587c.jpg.143x85_q85.jpg -> 143x85
6768113_sa.jpg.122x132_q85.jpg -> 122x132
Toshiba_50-Inch_Side.jpg.150x150_q85.jpg -> 150x150
What is the clever way to split width and height numbers from such string urls?
Upvotes: 0
Views: 132
Reputation: 1498
re.findall("[\d]+x[\d]+",variable_string)
but it will produce an duplication because the line 62620587b.jpg.122x132_q85.jpg -> 122x132
contain the AAxBB twice ,,, you can make an method that delete the duplication
Upvotes: 2