On Mon, Sep 8, 2014 at 12:17 PM, Felisha Lawrence
<felisha.lawre...@gmail.com> wrote:
> Is it possible to output strings created from a print statement into a
> directory locally?


Hi Felisha,

Yes.  This can be done from the level of your operating system shell,
rather than Python, through "output redirection".

    http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-3.html

Output redirection would be an extra-lingual approach to what you're
asking.  It's also fairly straightforward, and works well on Unix-like
systems.  It should also work on Windows, though I have to admit that
I don't have direct experience there.


As an intra-lingual feature, yes as well to your question.  You can
write to a file-like object instead of the systemwide "standard
output".  This requires you to be more specific whenever you're
writing output, to write it to that file.

For example, see the "file" argument to print:

    https://docs.python.org/2/library/functions.html#print

where every place where we'd use a simpler print where it implicitly
prints to the "standard output", we tell it to print to a file.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to