Dear lazyweb, I’m writing an application with Python and GTK+, and I’d like to parse command line arguments. I was thinking of using the PyGTK wrapped version of the Glib option parser, but I can’t find any tutorial for PyObject or application that uses it. Should I just use Python’s optparse instead?
-
Arquivo
- agosto 2010
- julho 2010
- junho 2010
- maio 2010
- abril 2010
- março 2010
- fevereiro 2010
- janeiro 2010
- dezembro 2009
- novembro 2009
- outubro 2009
- setembro 2009
- agosto 2009
- julho 2009
- junho 2009
- maio 2009
- abril 2009
- março 2009
- janeiro 2009
- dezembro 2008
- novembro 2008
- outubro 2008
- setembro 2008
- agosto 2008
- julho 2008
- junho 2008
- maio 2008
- abril 2008
- março 2008
- janeiro 2008
- dezembro 2007
- novembro 2007
- outubro 2007
- setembro 2007
- agosto 2007
- julho 2007
- junho 2007
- maio 2007
- abril 2007
-
Meta
We use optparse in Virtaal (and basically all of the Translate Toolkit). I can’t think of a reason why you wouldn’t want to use that.
nice alternative: http://code.google.com/p/argparse/ – parses both arguments and options
Yes, use optparse.
Pingback: Leonardo Ferreira Fontenelle: Parsing options in a PyGTK application | Full-Linux.com
Another vote for argparse. It does the whole job — positional arguments, and options, sub-commands — with a very nice API. It’s all in a single file, so you can bundle argparse.py, should you choose.