Bläddra i källkod

more proofread

master
Dimitri Merejkowsky 5 år sedan
förälder
incheckning
a21f510955
1 ändrade filer med 3 tillägg och 3 borttagningar
  1. +3
    -3
      sessions/python-10.md

+ 3
- 3
sessions/python-10.md Visa fil

@@ -64,7 +64,7 @@ ZeroDivisionError: division by zero
# Exemples d'erreurs

* `b += 2` - **NameError**
* `a / 9` - **ZeroDivisionError**
* `a / 0` - **ZeroDivisionError**
* `my_list[42]` - **IndexError**
* ``my_dict["bad-key"]`` - **KeyError**
* `1 + "two"` - **TypeError**
@@ -169,7 +169,7 @@ if exists():
```python
try:
file = open(filename)
catch IOError:
except IOError:
...
finally:
file.close()
@@ -181,7 +181,7 @@ Pas besoin de `finally` :)

```python
try:
with file = open(filename):
with open(filename) as file:
lines = file.readlines()
except FileNotFoundError:
print("Fichier non trouvé")