Connecting Tech Pros Worldwide Forums | Help | Site Map

Input and IDLE

Newbie
 
Join Date: Oct 2008
Posts: 14
#1: Oct 5 '08
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

Expert
 
Join Date: Sep 2007
Posts: 856
#2: Oct 5 '08

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