Re: Help with python output redirection

2006-04-15 Thread fatal.serpent
Thank you. Also this script is PublicDomain right?
Steven D'Aprano wrote:
> On Fri, 14 Apr 2006 16:59:13 -0700, fatalserpent wrote:
>
> > Here is the basic code (yes, I know its tiny).
> >
> > x = ['print "x =", x', 'for m in x: print m']
> > print "x =", x
> > for m in x: print m
> >
> > I want to modify this so it will output to a file called 1. What I want
> > is to have that file direct its output to a file called 2 and 2 direct
> > to 3 and so on. Hopefully this will be an easy-to-answer question. THX
> > in advance.
>
> From the shell, you are probably doing something like this:
>
> $ python mymodule.py
>
> Change it to this:
>
> $ python mymodule.py > 2
> $ python 2 > 3
> $ python 3 > 4
>
> and so on.
>
> Alternatively, you can do this:
>
> x = ['f = file("2", "w")', 'print >>f, "x =", x',
>  'for m in x: >>f, print m']
> print >>f, "x =", x
> for m in x: print >>f, m
>
> I'll leave changing the file name from "2" to "3" etc. as an exercise for
> you.
> 
> 
> -- 
> Steven.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help for a complete newbie

2006-04-16 Thread fatal.serpent
There was an extra space before ready. It works otherwise. Use the code
below or just remove the space.
Heres the fixed code:
ready = raw_input("Ready to proceed ? TYPE (y)es or (n)o: ")

if ready  == "y":
print "You are Ready"
else:
print "Try again"
Ralph H. Stoos Jr. wrote:
> All,
>
> I am reading a Python tutorial for complete non-programmers.
>
> The code below is so simple as to be insulting but the assignment of the
> "ready" variable gives a syntax error.
>
> The code reads letter-for-letter like the tutorial states.
>
> Here is a dump.  Can anyone tell me what is wrong?
>
> ***
>
> print " "
> print "This \"autotp\" program will create raw bitmap test pattern images."
> print " "
> print "Please read the information below thoroughly:"
> print " "
> print "1. Graphic files MUST be TIFF images."
> print "2. Images MUST have been ripped though a Nuvera system as a Print
> and Save job"
> print "3. Images should already be named with the desired file name."
> print "4. The Lead Edge and file name should be identified in the image."
> print "5. The name includes the purpose for, resolution of, side, and
> paper size"
> print "6. Images should be rotated to print correctly from Service
> Diagnostics."
> print " "
> print "EXAMPLE: Bypass_BFM_Damage_1200x1200_Letter.tif"
> print " "
>
> # Get the decision if operator is ready
>   ready = raw_input("Ready to proceed ? TYPE (y)es or (n)o: ")
>
>   if ready  == "y":
>   print "You are Ready"
>   else:
>   print "Try again"
>
> OUTPUT from execution
>
>   File "autotp.py", line 21
>  ready = raw_input("Ready to proceed ? TYPE (y)es or (n)o: ")
>  ^
> ***
>
> Please respond to the group and to:  [EMAIL PROTECTED]
> 
> Thanks,
> 
> Ralph

-- 
http://mail.python.org/mailman/listinfo/python-list