Skip to content

Instantly share code, notes, and snippets.

Embed
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
else:
return 'zlib'
if __name__ == '__main__':
print(parse(['--send', 'bz2']))
print(parse([]))
@hirokiky
Copy link
Author

hirokiky commented May 3, 2014

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

@aodag
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