Python: Difference between revisions

From DWIKI
mNo edit summary
Line 7: Line 7:
*[https://wiki.python.org/moin/BeginnersGuide/Programmers Beginners guide]
*[https://wiki.python.org/moin/BeginnersGuide/Programmers Beginners guide]
=HOWTO=
=HOWTO=
==Create virtual environment==
==virtual environment==
===Create virtual environment===
  mkdir myproject
  mkdir myproject
  cd myproject
  cd myproject
Line 14: Line 15:
and then you can
and then you can
  pip install whatever
  pip install whatever
===Leave virtual environment===
deactivate
=Data types=
=Data types=
==Tuples==
==Tuples==

Revision as of 12:51, 8 August 2024

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


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