notebook/IT/python/index.md

35 lines
704 B
Markdown
Raw Normal View History

2020-11-26 17:38:25 +00:00
# python
2021-04-20 21:13:14 +00:00
2020-11-26 17:38:25 +00:00
## référence
2021-04-20 21:13:14 +00:00
<https://github.com/gto76/python-cheatsheet/blob/master/README.md>
2020-11-26 17:38:25 +00:00
2022-06-23 16:26:13 +00:00
https://github.com/faif/python-patterns
2021-01-21 18:18:36 +00:00
Afficher les warning:```python -Wd```
Mode développement :`-X dev`
</details>
</details>`
2020-11-26 17:38:25 +00:00
## Virtual env
2021-04-20 21:13:14 +00:00
2020-11-26 17:38:25 +00:00
- create virtual env: `python3 -m venv /path`
- enter in virtual env: `source env/bin/activate`
- leave venv: `deactivate`
- list all installed package in file: `pip freeze > requirement.txt`
- install package list in file: `pip install -r requirement.txt`
## tips
2021-04-20 21:13:14 +00:00
2020-11-26 17:38:25 +00:00
- pprint permet d afficher vos structure de données
2021-04-20 21:13:14 +00:00
- la fonction dir() permet de lister les attribut d un
2021-01-06 19:22:00 +00:00
## unitest
2021-04-20 21:13:14 +00:00
### lancer une suite de tests
2021-01-21 18:18:36 +00:00
```python -m unittest tests.suite```