Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1d2fbbb

Browse files
authored
Update 06_Files.md
1 parent c6dc44e commit 1d2fbbb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Notes/01_Introduction/06_Files.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,17 @@ Try it:
220220

221221
```python
222222
>>> import gzip
223-
>>> with gzip.open('Data/portfolio.csv.gz') as f:
223+
>>> with gzip.open('Data/portfolio.csv.gz', 'rt') as f:
224224
for line in f:
225225
print(line, end='')
226226

227227
... look at the output ...
228228
>>>
229229
```
230230

231+
Note: Including the file mode of `'rt'` is critical here. If you forget that,
232+
you'll get byte strings instead of normal text strings.
233+
231234
### Commentary: Shouldn't we being using Pandas for this?
232235

233236
Data scientists are quick to point out that libraries like

0 commit comments

Comments
 (0)