Parsing files in python

Chris Angelico rosuav at gmail.com
Mon Dec 24 04:53:26 EST 2012


I'm hoping you meant for that to be public; if not, my apologies for
forwarding a private message.

On Mon, Dec 24, 2012 at 8:45 PM, Kene Meniru <kene.meniru at illom.org> wrote:
> Chris Angelico wrote:
>> from povray_macros import *
>>
>
> Am afraid you misunderstood my post. The file format I described is not an
> attempt to re-create or modify a python environment. I do not wish to be
> able to "import" python macros but other text files similar to the one I
> described.

Yep. There are two possibilities: Either you create a program that
reads in a file of format you invent, or you make a set of Python
functions and classes that mean that the format is actually a Python
script. Instead of writing a file parser, you use Python's, and the
program you write is actually a module rather than a top-level
application.

Producing output on stdout is one of the easiest and most standard
ways to export content.

ChrisA



More information about the Python-list mailing list