python
ubuntu 20.04 + install python 3.6
Install python 3.6:
sudo add-apt-repository ppa:deadsnakes/ppa sudo apt-get update sudo apt-get install python3.6If the virtualenv package is not installed, run:
apt-get update apt-get install python3-virtualenvCreate a virtual environment:
virtualenv -p /usr/bin/python3.6 venv
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 2
If you want to change the default again, you can simply write:
sudo update-alternatives --config python
Python handbook
http://webéducation.com/wp-content/uploads/2020/08/G%C3%A1bor-Szab%C3%B3-1000-Python-Examples-leanpub.com-2020.pdf
sudo apt-get install python-pip python2.7-dev libxext-dev python-qt4 qt4-dev-tools
sudo apt-get install build-essential
sudo apt-get install python-pip
sudo apt-get install python-pyside
sudo apt-get install python3-pyside
install eclipse
install pydev
"Thai (iso 8859-11)": "iso-8859-11"
conn = MySQLdb.connect (
host = "localhost",
user = "user",
passwd = "pass",
db = "db",
use_unicode=True,
charset='utf8')
Currently, Qt Creator allows you to create Python files (not projects) and run them. It also has syntax highlighting, but it lacks more complex features such as autocomplete.
Running scripts requires some configuration (I used this tutorial). Open Qt Creator and go to Tools->Options->Environment->External Tools. Click Add->Add category and create a new category (for example, Python). Then, select the created category and click Add->Add Tool to create a new tool - RunPy for example. Select the created tool and fill the fields on the right:
Description - any value
Executable - path to python.exe
Arguments - %{CurrentDocument:FilePath}
Working directory - %{CurrentDocument:Path}
Environment - QT_LOGGING_TO_CONSOLE=1
You get something like this:
Now, go to File->New File or Project->Python and select Python source file. To run the created script: Tools->External->Python->RunPy
PyDev Plugin
PyDev is a Python IDE for Eclipse, which may be used in Python, Jython andIronPython development.
2.3.1 Donwload and Install PyDev Plugin
First open Eclipse and go to Help Install New Software...
In Work with: type PyDev - http://pydev.org/updates and press tha button Add...Then check the first option PyDev and click Next
case someChar of 'a': actionOnA; 'x': actionOnX; 'y','z':actionOnYandZ; else actionOnNoMatch;end;
C:
switch (someChar) { case 'a': actionOnA; break; case 'x': actionOnX; break; case 'y': case 'z': actionOnYandZ; break; default: actionOnNoMatch;}
case $someChar in a) actionOnA; ;; x) actionOnX; ;; [yz]) actionOnYandZ; ;; *) actionOnNoMatch ;;esac