Newbie question: where is "Script Mode"? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Newbie question: where is "Script Mode"?

LobomoonLobomoon Posts: 7Member
I just started using Python and I'm pretty comfortable with "Interactive Mode" - I can access it either in the form of something that looks like a dos window or something that looks like notepad. But how do I access "Script Mode"? First I thought the notepad-thingy would be it but every time I press "enter" to go to new line it actually executes the line I just typed.

Please help...

Comments

  • infidelinfidel Posts: 2,900Member
    : I just started using Python and I'm pretty comfortable with "Interactive Mode" - I can access it either in the form of something that looks like a dos window or something that looks like notepad. But how do I access "Script Mode"? First I thought the notepad-thingy would be it but every time I press "enter" to go to new line it actually executes the line I just typed.

    You have to save your commands in a plain text file. If you're using IDLE, you can open a new File and save it with a .py extension. Then depending on your operating system and personal preferences, you can:

    double-click script file (Windows)
    use shebang line (Linux, etc): #! /usr/bin/python
    use command line (all): python scriptname.py


    [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]

    [code]
    $ select * from users where clue > 0
    no rows returned
    [/code]

  • LobomoonLobomoon Posts: 7Member
    It worked! Thanks. One more thing - when in IDLE I open new window and write my program is isn't color-coded as in IDLE itself (for example when I type "print" it turns it orange). Is it possible to make it color-coded - I find it helpful.
  • infidelinfidel Posts: 2,900Member
    : It worked! Thanks. One more thing - when in IDLE I open new window and write my program is isn't color-coded as in IDLE itself (for example when I type "print" it turns it orange). Is it possible to make it color-coded - I find it helpful.

    Once you save it with a .py extension then IDLE should recognize it as a python script and colorify it.


    [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]

    [code]
    $ select * from users where clue > 0
    no rows returned
    [/code]

Sign In or Register to comment.