The official example of glob
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> import glob | |
>>> glob.glob('./[0-9].*') | |
['./1.gif', './2.txt'] | |
>>> glob.glob('*.gif') | |
['1.gif', 'card.gif'] | |
>>> glob.glob('?.gif') | |
['1.gif'] | |
>>> glob.glob('**/*.txt', recursive=True) | |
['2.txt', 'sub/3.txt'] | |
>>> glob.glob('./**/', recursive=True) | |
['./', './sub/'] | |
>>> import glob | |
>>> glob.glob('*.gif') #find .gif file | |
['card.gif'] | |
>>> glob.glob('.c*') #find .gif file whose names start with. | |
['.card.gif'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment