[PyAR2] Writing to a text file

Derek Horton derek.k.horton at gmail.com
Wed Jun 9 06:41:23 CEST 2010

Since you are using linux there are a couple of things you can do.  First,
you could redirect the output (stdout) of your script to a file and then use
an editor to view the file.
   python script.py > results.txt
Now open the results.txt file in your favorite editor.

Or you could pipe the output into less which will allow you to page through
the output of your script by hitting the space bar.
   python script.py | less



On Tue, Jun 8, 2010 at 10:09 PM, Daniel Veazey <daniel at danielveazey.com>wrote:

>  Hi, I'm totally new. I wrote a short program to find combinations on a
> bike lock that have adjacent double digits. The lock has 4 digits, and each
> digit can have a value of 1-6. So 1442 would have adjacent double digits,
> and 1424 would not. Here is the program:
> http://pastebin.com/SzGCwMR9
> The problem I'm having is that when I run the program in a Linux terminal,
> by the time all the combinations have been printed, the first half of the
> combinations have run out of the top of the terminal's window.
> So what I'd like to do is instead of just printing the numbers on the
> screen, write them to a text file. Is there a way to do this? Does it have
> something to do with stdout?
> Thanks,
> Daniel Veazey
> danielveazey.com <http://www.danielveazey.com>
> _______________________________________________
> PyAR2 mailing list
> PyAR2 at python.org
> http://mail.python.org/mailman/listinfo/pyar2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/mailman/private/pyar2/attachments/20100608/d5f94d2c/attachment.html>

More information about the PyAR2 mailing list