|
From: Aahz <aa...@py...> - 2002-09-13 07:16:40
|
On Thu, Sep 12, 2002, David Goodger wrote:
> Aahz wrote:
>>
>> In all the discussion of include files, it's still not clear to me how
>> best to accomplish what I want: including a .py file as text. I don't
>> want the text in the reST file because I'm going to use a *second*
>> include directive to get the output from the .py file.
>
> I'm not sure I understand what you're saying. By "including a .py file as
> text", do you mean that you want to insert a .py file into the document as a
> **literal block**? I don't think that's part of the proposal Dethe is
> working on, but it seems useful and simple enough to do. Something like::
>
> .. include:: example.py
> :literal:
>
> If that's not what you meant, please explain.
Yeah, I think that's what I meant, but I don't know reST well enough to
be certain. ;-)
> And I don't follow the second sentence at all. Perhaps an illustrative
> example?
Well, suppose I've got the following Python code::
print "Hello, world!"
I'm going to want to include both::
print "Hello, world!"
and::
Hello, world!
Thus, there needs to be a directive to *run* the Python code and capture
stdout (and/or stderr), probably as some kind of literal block.
--
Aahz (aa...@py...) <*> http://www.pythoncraft.com/
Project Vote Smart: http://www.vote-smart.org/
|