Super-rexex?

Gordon McMillan gmcm at hypernet.com
Thu Dec 23 10:36:55 EST 1999


Fred L. Drake, Jr. wrote:
> Gerrit Holl writes:
[snip]
> Gerrit,
>   I presume you want the file to have things like this:
> 
> FOO = "foo value"
> BAR = "bar again?"
> 
>   If that's it, there are a couple of ways to do it.  The one
>   that
> probably makes the most sense is to change the systax of the file
> and use the ConfigParser module to parse an .ini type file:
> 
> [MyConfiguration]
> FOO=foo value
> BAR=bar again?
> 
>   Another, more painful approach, but which allows the specific
>   format
> you describe, would be to write your own parser for it.  You can
> use the tokenize module to help out with tokenization, but it's
> up to you to do the actual parse.  Chances are good John Aycock's
> tools would really help out.

Isn't that the kind of parsing that shlex is good at? I'm inclined 
to think that John's (highly capable, wonderful, etc. etc.) tools 
are bit more than is required here.

- Gordon




More information about the Python-list mailing list