You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

python-11.md 557 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. % Programmation avec Python (chapitre 11)
  2. % Dimitri Merejkowsky
  3. \center \huge Retour sur les exceptions
  4. # A quoi sert finally
  5. ```python
  6. try:
  7. fp = open("file.txt")
  8. 1 / 0
  9. except ZeroDivisionError:
  10. print("got you")
  11. finally:
  12. print("closing")
  13. fp.close()
  14. ```
  15. Que se passe-t-il si on remplace `1/0` par
  16. `my_list[42]` ?
  17. \center \huge Libraries tierces
  18. # Introduction: pip
  19. * python3 -m pip
  20. * `--user`
  21. But: what about several projects?
  22. # Virtualenvs
  23. # pip + virtualenv = <3
  24. # Tuto
  25. * Let's install requests!
  26. ```
  27. # avant
  28. # après
  29. ```