Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to capture patterns in glob style with Python 2.7 argparse
# coding=utf-8
import argparse
import pprint
from glob import glob
def main():
parser = argparse.ArgumentParser(description='Get some files according to a pattern')
parser.add_argument('pattern', type=file, action='store', nargs='+')
args = parser.parse_args()
pp = pprint.PrettyPrinter(indent=4)
if __name__ == "__main__":
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment