Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import argparse
def parse(args):
parser = argparse.ArgumentParser()
parser.add_argument('--send', choices=['zlib', 'bz2', 'none'], dest='send')
parsed = parser.parse_args(args)
if parsed.send:
return parsed.send
return 'zlib'
if __name__ == '__main__':
print(parse(['--send', 'bz2']))
Copy link

hirokiky commented May 3, 2014

i thought this solution is little shame. cooler one must be there huh.

Copy link

aodag commented May 3, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment