vendredi 24 avril 2015

Run a script in Python

I'm a beginner in Python. I'm trying to launch a few lines of code to understand how it works (Python 3.4). My doubts are about the different enviroments of the language: I have an editor in which I can write a script and run it, an environment called shell, where I can interact with the terminal and an environment with command line (console) . I would like to understand what are the differences between these three enviroment, in particular:

  • In Editor (new file) from the menu run I can choice Python Shell and Run Module, which is the difference between the two?

  • What is the difference between the shell environment and the command line one? I noticed that if I launch from shell something like:

    if 2==2:

    print("ok")

this is executed correctly, but if I execute the same if statement directly from the command line, there is this error:

File "<stdin>", line2
print("ok")
IdentationError: expected an indented block

Beyond my doubts, I really appreciate if someone would explain me generally the difference between shell and command line, thanks.

Aucun commentaire:

Enregistrer un commentaire