Prev: Plain simple unix timestamp with an HTTP GET
Next: questions about how to parse a string and put it in a dictionary
From: Ben Finney on 3 Jun 2010 21:47 steph_awk <stephane.larochelle(a)gmail.com> writes: > I have been searching for quite some times without success. Did you try the standard library? > I have a python script that needs to start from command line and it > should have a config file to fill out the detais (itis one program, > and many possible configurations). The 'ConfigParser' module in Python 2.x, or 'configparser' in Python 3.x <URL:http://docs.python.org/library/configparser> reads Windows INI-style configuration files into Python data structures. > something as simple as PHP would be nice %> ./PHPscript -c configfile > > is there such a thing in Python? For handling command-line arguments, see 'optparse' <URL:http://docs.python.org/library/optparse> or 'getopt' <URL:http://docs.python.org/library/getopt>. A significant improvement is available in the 'argparse' module, currently third-party <URL:http://pypi.python.org/pypi/argparse> but on track for inclusion in the Python standard library <URL:http://www.python.org/dev/peps/pep-0389/>. -- \ “Pinky, are you pondering what I'm pondering?” “Uh, I think so, | `\ Brain, but we'll never get a monkey to use dental floss.” | _o__) —_Pinky and The Brain_ | Ben Finney |