Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old October 5th, 2008, 02:43 AM
Newbie
 
Join Date: Oct 2008
Posts: 8
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, 05:20 AM
Expert
 
Join Date: Sep 2007
Posts: 848
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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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 network members.
Post your question now . . .
It's fast and it's free

Popular Articles