Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
The official example of glob
>>> import glob
>>> glob.glob('./[0-9].*')
['./1.gif', './2.txt']
>>> glob.glob('*.gif')
['1.gif', 'card.gif']
>>> glob.glob('?.gif')
>>> glob.glob('**/*.txt', recursive=True)
['2.txt', 'sub/3.txt']
>>> glob.glob('./**/', recursive=True)
['./', './sub/']
>>> import glob
>>> glob.glob('*.gif') #find .gif file
>>> glob.glob('.c*') #find .gif file whose names start with.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment