#!/usr/bin/env python # encoding: utf-8 # # Copyright (c) 2010 Doug Hellmann. All rights reserved. # """Choice enumerations for option values. """ #end_pymotw_header import optparse parser = optparse.OptionParser() parser.add_option('-c', type='choice', choices=['a', 'b', 'c']) options, args = parser.parse_args() print 'Choice:', options.c