Skip to content

Commit a5529ae

Browse files
committed
Context managers
1 parent 9edacdb commit a5529ae

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,14 +1204,14 @@ class MyOpen():
12041204
Hello World!
12051205
```
12061206

1207-
#### List of context managers:
1207+
#### Context managers:
12081208
```python
12091209
with open('<path>', ...) as file: ...
12101210
with wave.open('<path>', ...) as wave_file: ...
12111211
with memoryview(<bytes/bytearray/array>) as view: ...
12121212
```
12131213

1214-
#### List of reusable context managers:
1214+
#### Reusable context managers:
12151215
```python
12161216
lock = threading.RLock(); with lock: ...
12171217
con = sqlite3.connect('<path>'); with con: con.execute('<insert_query>')

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,12 +1122,12 @@ <h3 id="contextmanager">Context Manager</h3>
11221122
<span class="hljs-meta">... </span> print(file.read())
11231123
Hello World!
11241124
</code></pre>
1125-
<h4 id="listofcontextmanagers">List of context managers:</h4>
1125+
<h4 id="contextmanagers">Context managers:</h4>
11261126
<pre><code class="python language-python hljs"><span class="hljs-keyword">with</span> open(<span class="hljs-string">'&lt;path&gt;'</span>, ...) <span class="hljs-keyword">as</span> file: ...
11271127
<span class="hljs-keyword">with</span> wave.open(<span class="hljs-string">'&lt;path&gt;'</span>, ...) <span class="hljs-keyword">as</span> wave_file: ...
11281128
<span class="hljs-keyword">with</span> memoryview(&lt;bytes/bytearray/array&gt;) <span class="hljs-keyword">as</span> view: ...
11291129
</code></pre>
1130-
<h4 id="listofreusablecontextmanagers">List of reusable context managers:</h4>
1130+
<h4 id="reusablecontextmanagers">Reusable context managers:</h4>
11311131
<pre><code class="python language-python hljs">lock = threading.RLock(); <span class="hljs-keyword">with</span> lock: ...
11321132
con = sqlite3.connect(<span class="hljs-string">'&lt;path&gt;'</span>); <span class="hljs-keyword">with</span> con: con.execute(<span class="hljs-string">'&lt;insert_query&gt;'</span>)
11331133
</code></pre>

0 commit comments

Comments
 (0)