-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Brad Knowles wrote: | At 1:55 PM +0000 2005-01-18, John Poltorak wrote: |> Well I guess I need to dip my toes in the water regarding Python at some |> time... How do I put a pause in the program at this point? I don't even |> know how to code a 'print' statement.. | | I'll have to leave this question to one of the other people who have | knowledge of programming in Python.
Okay, I'll try :-)
Pausing can for example be accomplished by reading a line from the standard input:
raw_input()
The print-Statement is very easy, too. You just give it something to print to standard output:
print "Hello World" print 10
A trailing comma will prevent the newline from being added at the end. You can separate different things to print by putting a comma in between:
print "Hello World!",10,
This will print the String "Hello World! 10 " to the terminal. Note that each comma (including the trailing one) inserts one space. Of course, you can use string concatenation (with +) instead of commas thereby avoiding the extra spaces. In these cases you might want to use str(x) to convert object x into a string:
print "Hello World!"+str(10)
Finally, you can print to a different file, e.g. standard error, by using the following syntax:
print >> sys.stderr, "This goes to the standard error."
Hope that helps, Peter -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFB7SN23VbrCXkKHhwRAvdeAJwKAtiE8q8DeUONwAc9AeW00yTnHwCglL7o Qc7vUwhQ5G2F6Pj3+yAHM7w= =W79T -----END PGP SIGNATURE-----
------------------------------------------------------ Mailman-Users mailing list [email protected] http://mail.python.org/mailman/listinfo/mailman-users Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
