Super-rexex?
Gerrit Holl
gerrit.holl at pobox.com
Thu Dec 23 15:43:53 EST 1999
Gerrit Holl asked:
[Super rexec for execfile() with strings only?]
Fred L. Drake, Jr. answered:
[ConfigParser module]
Gordon McMillan reacted:
[shlex module]
They both don't seem to be what I want.
I'm reinventing the wheel if I use them. *All* I want is having
a dictionairy with the same string rules Python uses. Not many
users will need to see the file: only translators will. If
I've got a file like this:
foo="content of foo...BEEP\a...BEEP\a..."
bar='A string...\n\
with fun...'
foobar="""If you want to have a string, spanning multiple lines,
containing ' and " many times, triple quotes suit the best..."""
And the function should a dictionairy like:`:
{'foo': 'content of foo...BEEP\a...BEEP\a...',
'bar': 'A string...\012with fun...',
'foobar': 'If you [...] lines,\012containing \' and " many [...] best...'}
So in fact, execfile() is almost exactly what I need. It's SO CLOSE, it's
a pity to parse a file with shlex() for it...
Shall I just keep secret to translators, so that only people who've read
the source and people who've read this message know it? Much easier, but
quite ugly...
regards,
Gerrit.
--
"The IETF motto is 'rough consensus and running code'"
-- Scott Bradner (Open Sources, 1999 O'Reilly and Associates)
9:24pm up 10:42, 13 users, load average: 0.08, 0.02, 0.05
More information about the Python-list
mailing list