Python Optparse list

S.Lott’s answer has already been accepted, but here’s a code sample for the archives:

def foo_callback(option, opt, value, parser):
  setattr(parser.values, option.dest, value.split(','))

parser = OptionParser()
parser.add_option('-f', '--foo',
                  type="string",
                  action='callback',
                  callback=foo_callback)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)