Как использовать функцию glob.escape () в Python
import glob
files = glob.glob("D:\\**\\*.jpg",recursive=True)
# All jpg files
print(files)
#JPEGs files with special characters in their name
# set of special characters _, $, #
char_seq = "_$#"
for char in char_seq:
results = "*" + glob.escape(char) + "*" + ".jpg"
for file in (glob.glob(results)):
print(file)
Pythonist