Connecting Tech Pros Worldwide Help | Site Map

Input and IDLE

  #1  
Old October 5th, 2008, 02:43 AM
Newbie
 
Join Date: Oct 2008
Posts: 12
Howdy,

New to python and have two quick questions.

I need to write a program that is executed like:

python myprogram < input.txt

on the command line. I am uncertain how to do this. If anyone could give me a hint that would be super.

Also on the form there has been some reference to IDLE. I know it is an IDE but not sure how to get it (on mac os x) or if it would come preinstaled. As of write now I am writting in text mate and just running by going python programName.py.

Strange that there is no compliling in python.. Any comments?

Thanks for reading!

JS
  #2  
Old October 5th, 2008, 05:20 AM
Expert
 
Join Date: Sep 2007
Posts: 857

re: Input and IDLE


Write your program as though it accepts input from the keyboard. The <means to redirect "standard in," which defaults to the keyboard, to the file/device in the next token. Then, every time you read from "the keyboard," you're actually reading from the file.

As to IDLE, just Google. Keep in mind that you generally cannot do redirection like this from inside an IDE.
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
IDLE Russ P. answers 5 November 5th, 2007 02:45 AM
How to pass an argument to a python program open in IDLE? tony.ha@philips.com answers 4 November 17th, 2006 03:05 PM
Typing UTF-8 characters in IDLE kazuo fujimoto answers 2 October 12th, 2006 02:15 AM
running IDLE from another program? John Salerno answers 13 April 5th, 2006 01:05 AM
How to detect application idle time. Frank Rizzo answers 19 November 16th, 2005 02:58 PM