Python

From DWIKI
Revision as of 14:47, 19 November 2024 by Tony (talk | contribs) (→‎Listen on http)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Links

HOWTO

virtual environment

Create virtual environment

mkdir myproject
cd myproject
python -m venv venv
source venv/bin/activate

and then you can

pip install whatever

Listen on http

Python http server

python3 -m http.server 8080


Leave virtual environment

deactivate

Data types

Tuples

Tuples methods

Regex

Strings

Length of string

len(s)

Lists

List operators

Regular expressions

https://docs.python.org/3/library/re.html

FAQ

-bash: python: command not found

Try

update-alternatives --config python

update-alternatives: error: no alternatives for python

update-alternatives --install /usr/bin/python python $(which python3) 1

Leave virtualenv

deactivate