Mighty Love Tv
Mighty Love Tv

Reputation: 1

Getting all files beginning with a specific name and ends with any pattern in glob function (Python)

Please I want to get all files that begins with [a letter]_lehn_[any word or letter] and I wrote this code (Python code in ipython notebook). But it didn't return any file for me. Example of some of my files are "A_lehn_1(23)","4 B_lehn_1(2)copy".

import glob

from image_file_name in glob.glob('?_lehn_?.png'):```

Upvotes: 0

Views: 1405

Answers (1)

Shawn Ramirez
Shawn Ramirez

Reputation: 833

wildcards should work....

import glob
from image_file_name in glob.glob('*'+ '_lehn_' + '*' + '.png'): 

Upvotes: 2

Related Questions