'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'):```


Solution 1:[1]

wildcards should work....

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shawn Ramirez