2016-09-22 08:03:38 +01:00
|
|
|
# python
|
2015-11-22 20:27:42 +00:00
|
|
|
|
2016-01-12 19:14:57 +00:00
|
|
|
> Python language interpreter.
|
2019-05-23 11:56:50 +01:00
|
|
|
> More information: <https://www.python.org>.
|
2015-11-22 20:27:42 +00:00
|
|
|
|
2021-09-12 15:03:27 +01:00
|
|
|
- Start a REPL (interactive shell):
|
2015-11-22 20:27:42 +00:00
|
|
|
|
|
|
|
`python`
|
|
|
|
|
2021-11-02 16:45:07 +00:00
|
|
|
- Execute a specific Python file:
|
2015-11-22 20:27:42 +00:00
|
|
|
|
2021-11-02 16:45:07 +00:00
|
|
|
`python {{path/to/file.py}}`
|
2015-11-22 20:27:42 +00:00
|
|
|
|
2021-11-02 16:45:07 +00:00
|
|
|
- Execute a specific Python file and start a REPL:
|
2015-11-22 20:27:42 +00:00
|
|
|
|
2021-11-02 16:45:07 +00:00
|
|
|
`python -i {{path/to/file.py}}`
|
2018-10-17 14:20:12 +01:00
|
|
|
|
|
|
|
- Execute a Python expression:
|
|
|
|
|
|
|
|
`python -c "{{expression}}"`
|
2015-12-09 19:30:14 +00:00
|
|
|
|
2021-10-16 19:22:04 +01:00
|
|
|
- Run the script of the specified library module:
|
2015-12-09 19:30:14 +00:00
|
|
|
|
2015-12-09 20:28:39 +00:00
|
|
|
`python -m {{module}} {{arguments}}`
|
2018-10-17 14:20:12 +01:00
|
|
|
|
2021-10-16 19:22:04 +01:00
|
|
|
- Install a package using `pip`:
|
2020-11-27 01:02:20 +00:00
|
|
|
|
2023-08-26 18:30:06 +01:00
|
|
|
`python -m pip install {{package}}`
|
2020-11-27 01:02:20 +00:00
|
|
|
|
2018-10-17 14:20:12 +01:00
|
|
|
- Interactively debug a Python script:
|
|
|
|
|
2023-12-21 07:26:25 +00:00
|
|
|
`python -m pdb {{path/to/file.py}}`
|
2021-10-31 05:07:39 +00:00
|
|
|
|
|
|
|
- Start the built-in HTTP server on port 8000 in the current directory:
|
|
|
|
|
2023-12-21 07:26:25 +00:00
|
|
|
`python -m http.server`
|