Input and IDLE

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sixtyfootersdude
    New Member
    • Oct 2008
    • 14

    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
  • Laharl
    Recognized Expert Contributor
    • Sep 2007
    • 849

    #2
    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.

    Comment

    Working...