fork download
  1. images = ['tyre_2.jpg', 'bar_0.heic', 'hello.jpg', 'wheel_0.jpg']
  2. import re
  3. rx = re.compile(r'.+_(?!0\.)\d+\.jpg$')
  4. print([x.rsplit('.')[0] for x in filter(rx.match, images)])
  5. # => ['tyre_2.jpg']
Success #stdin #stdout 0.03s 9464KB
stdin
Standard input is empty
stdout
['tyre_2']