Python: Difference between revisions
From DWIKI
Tag: wikieditor |
m →Links Tag: wikieditor |
||
| Line 3: | Line 3: | ||
*[http://www.python.org/ Homepage] | *[http://www.python.org/ Homepage] | ||
*[https://peps.python.org/pep-0008/ PEP 8 – Style Guide for Python Code= | |||
==Tutorials== | |||
*[https://www.w3schools.com/python/ w3schools] | *[https://www.w3schools.com/python/ w3schools] | ||
*[https://www.tutorialspoint.com/python https://www.tutorialspoint.com/python] | *[https://www.tutorialspoint.com/python https://www.tutorialspoint.com/python] | ||
*[https://wiki.python.org/moin/BeginnersGuide/Programmers Beginners guide] | *[https://wiki.python.org/moin/BeginnersGuide/Programmers Beginners guide] | ||
=HOWTO= | =HOWTO= | ||
==virtual environment (venv)== | ==virtual environment (venv)== | ||
Revision as of 10:52, 16 January 2026
Links
- Homepage
- [https://peps.python.org/pep-0008/ PEP 8 – Style Guide for Python Code=
Tutorials
HOWTO
virtual environment (venv)
Create virtual environment
mkdir myproject cd myproject python -m venv venv source venv/bin/activate
and then you can
pip install whatever
Leave venv
deactivate
Listen on http
python3 -m http.server 8080
Leave virtual environment
deactivate
Link python to python3 on Ubuntu
update-alternatives --install /usr/bin/python python /usr/bin/python3 1
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
Leave virtualenv
deactivate
Python shebang
#!/usr/bin/env python3
Error messages
-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
