Created
November 30, 2010 20:51
-
-
Save nautilebleu/722377 to your computer and use it in GitHub Desktop.
How to capture patterns in glob style with Python 2.7 argparse
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
#!/usr/local/bin/python2.7 | |
# 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) | |
pp.pprint(args.pattern) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment