[Tutor] Config files & getopt()
Fri, 28 Dec 2001 10:12:35 +0530
see of this is useful...
it creates a config file and then reads from it.
>>> from ConfigParser import *
>>> fp = open("test.conf","w+")
>>> c = ConfigParser()
........Now read from the same.....
>>> f = open("test.conf","r")
userid = octago
password = octago
dsn = octago
log = d:\temp\logs
templates = d:\temp\templates
never used getopt though
From: firstname.lastname@example.org [mailto:email@example.com]On Behalf Of
Sent: Friday, December 28, 2001 5:05 AM
Subject: [Tutor] Config files & getopt()
First, thanks for the help on IP sorting. I added it to the program and it
If it gets to the point I like it, I may post it here as an example of how
-NOT- to do data reduction and generate statistical data on a million+ line
I am still tinkering with other stuff too...
As a background, I have -0- programming experience and am learning both
Python and programming from scratch. So far so good, however I am having
problems understanding two things I need for something I am writing.
The first is getopt(). I just don't get it. Can someone give a better
description of it, other than is presented in the module, (with examples
too! :) )? I have tried that one, the O'Reily book and searching
online..and I am still kinda lost...although I do know
getopt(arg,option(,long options)) :)
The second, is I would like to add a config file to program..something
along the lines of an apache httpd.conf file, to specify directories and
the like. I checked out ConfigParser...and I just dont get it..
Ok..so I am feeling moronic today :)
Any kind soul wanna hand hold a true newbie?
Thanks in advance..
Tutor maillist - Tutor@python.org