0

In a portion of a Python script, I'm trying to select all images with formats such as the examples below:

customImage0.jpg customImage1.png customImage3.gif

I currently have this code:

pattern = re.compile('customImage[0-9]*.png')

I want to modify it so I can select all image extension types, not just png. I've tried [jpg|png|gif|tiff]. That grabbed only the first letter of the file extension:

customImage0.j customImage1.p

How do I grab the whole file extension?

TigerhawkT3
  • 46,954
  • 6
  • 53
  • 87
velkoon
  • 765
  • 1
  • 12
  • 32

0 Answers0