Re: need an alternative to getattr()

2006-08-07 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > import heading1 > import heading2 > While True: > heading = get_next_heading(file_ptr) # This func will return > "heading1", then "heading2"(on next call) > if heading = "": > break > getattr(heading, "process")(file_ptr

Re: need an alternative to getattr()

2006-08-07 Thread Ant
> getattr(heading, "process")(file_ptr) ... > Is there an alternatice to getattr() that will solve my problem, or is > there another way to do it. How about: eval("%s.process(%s)" % (heading, file_ptr)) -- http://mail.python.org/mailman/listinfo/python-list

Re: need an alternative to getattr()

2006-08-07 Thread Uffe Wassmann
I think you would benefit from looking at the ConfigParser module. I haven't tried it yet, but it looks like a nice interface for writing and reading configuration files. -Uffe. On 7 Aug 2006 07:30:41 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > > AIM: I have a config file that con