1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/python.md

37 lines
689 B
Markdown
Raw Normal View History

# python
2015-11-22 22:27:42 +02:00
> Python language interpreter.
> More information: <https://www.python.org>.
2015-11-22 22:27:42 +02:00
- Start a REPL (interactive shell):
2015-11-22 22:27:42 +02:00
`python`
- Execute a specific Python file:
2015-11-22 22:27:42 +02:00
`python {{path/to/file.py}}`
2015-11-22 22:27:42 +02:00
- Execute a specific Python file and start a REPL:
2015-11-22 22:27:42 +02:00
`python -i {{path/to/file.py}}`
2018-10-17 07:20:12 -06:00
- Execute a Python expression:
`python -c "{{expression}}"`
2015-12-09 20:30:14 +01:00
- Run the script of the specified library module:
2015-12-09 20:30:14 +01:00
2015-12-09 21:28:39 +01:00
`python -m {{module}} {{arguments}}`
2018-10-17 07:20:12 -06:00
- Install a package using `pip`:
`python -m pip install {{package}}`
2018-10-17 07:20:12 -06:00
- Interactively debug a Python script:
`python -m {{pdb}} {{path/to/file.py}}`
- Start the built-in HTTP server on port 8000 in the current directory:
`python -m {{http.server}}`