
上QQ阅读APP看书,第一时间看更新
How to do it...
- A number of options are available for the Python command-line call. To enter interactive mode, call Python with no additional options:
$ python
Python 3.6.3 |Anaconda, Inc.| (default, Oct 13 2017, 12:02:49)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for
more information.
>>>
- To execute a regular Python program with no special options, add the program name:
$ python <script>.py
- To execute a series of Python commands without entering interactive mode or calling a file, use -c:
$ python -c "print('Hello World')"
- To call a Python module as a standalone program, use -m:
$ python -m random
- Discussion of the other possible options is provided in the following section.