Send
Close Add comments:
(status displays here)
Got it! This site "robinsnyder.com" uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website. Note: This appears on each machine/browser from which this site is accessed.
The Python command line
1. The Python command line
If Python is run without a file to load, Python displays a command line into which Python commands (expressions, statements) can be typed.
Python works as if each program part is typed and then evaluated.
For a function, class, etc., only syntax is checked until that part is needed. So an undefined function or class is not detected until that function or class is needed, at which time an error message would be generated.
2. Expressions
Type the following expression and press
Enter.
2+3
The result of
5 is displayed.
3. Modules
Type the following expression and press
Enter.
import numpy
If the
numpy module is available, it is loaded and nothing is displayed. That is good.
If not, an error message is displayed.
Type the following expression and press
Enter.
import numpyx
Unless you actually have a module called
numpyx, an error message should be displayed.
4. End of page