Skip to content

Commit e9a0170

Browse files
committed
Table
1 parent 19808cb commit e9a0170

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1905,7 +1905,7 @@ Table
19051905
# $ pip3 install tabulate
19061906
from tabulate import tabulate
19071907
import csv
1908-
with open(<filename>, encoding='utf-8') as file:
1908+
with open(<filename>, encoding='utf-8', newline='') as file:
19091909
lines = csv.reader(file, delimiter=';')
19101910
headers = [header.title() for header in next(lines)]
19111911
table = tabulate(lines, headers)

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1613,7 +1613,7 @@ <h4 id="printsacsvfileasanasciitable">Prints a CSV file as an ASCII table:</h4>
16131613
<pre><code class="python language-python hljs"><span class="hljs-comment"># $ pip3 install tabulate</span>
16141614
<span class="hljs-keyword">from</span> tabulate <span class="hljs-keyword">import</span> tabulate
16151615
<span class="hljs-keyword">import</span> csv
1616-
<span class="hljs-keyword">with</span> open(&lt;filename&gt;, encoding=<span class="hljs-string">'utf-8'</span>) <span class="hljs-keyword">as</span> file:
1616+
<span class="hljs-keyword">with</span> open(&lt;filename&gt;, encoding=<span class="hljs-string">'utf-8'</span>, newline=<span class="hljs-string">''</span>) <span class="hljs-keyword">as</span> file:
16171617
lines = csv.reader(file, delimiter=<span class="hljs-string">';'</span>)
16181618
headers = [header.title() <span class="hljs-keyword">for</span> header <span class="hljs-keyword">in</span> next(lines)]
16191619
table = tabulate(lines, headers)

0 commit comments

Comments
 (0)