Connecting Tech Pros Worldwide Help | Site Map

Input and IDLE

 
LinkBack Thread Tools Search this Thread
  #1  
Old October 5th, 2008, 01:43 AM
Newbie
 
Join Date: Oct 2008
Posts: 10
Default Input and IDLE

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
Reply
  #2  
Old October 5th, 2008, 04:20 AM
Expert
 
Join Date: Sep 2007
Posts: 855
Default

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
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search


Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.