diff --git a/files.html b/files.html index 14f013c..326eb72 100644 --- a/files.html +++ b/files.html @@ -414,16 +414,22 @@ AttributeError: '_io.BufferedReader' object has no attribute 'encoding' you@localhost:~$ python3 >>> import gzip ->>> with gzip.open('out.log.gz', mode='wb') as z_file: +>>> with gzip.open('out.log.gz', mode='wb') as z_file: ① ... z_file.write('A nine mile walk is no joke, especially in the rain.'.encode('utf-8')) ... >>> exit() -you@localhost:~$ ls -l out.log.gz +you@localhost:~$ ls -l out.log.gz ② -rw-r--r-- 1 mark mark 79 2009-07-19 14:29 out.log.gz -you@localhost:~$ gunzip out.log.gz -you@localhost:~$ cat out.log +you@localhost:~$ gunzip out.log.gz ③ +you@localhost:~$ cat out.log ④ A nine mile walk is no joke, especially in the rain. +
'b' character in the mode argument.)
+gunzip command (pronounced “gee-unzip”) decompresses the file and stores the contents in a new file named the same as the compressed file but without the .gz file extension.
+cat command displays the contents of a file. This file contains the string you originally wrote directly to the compressed file out.log.gz from within the Python Shell.
+⁂