瀏覽代碼

more proofread

master
Dimitri Merejkowsky 5 年之前
父節點
當前提交
a21f510955
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. +3
    -3
      sessions/python-10.md

+ 3
- 3
sessions/python-10.md 查看文件

@@ -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é")