summaryrefslogtreecommitdiffstats
path: root/Doc/library/lzma.rst
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2012-09-29 07:27:15 (GMT)
committerGeorg Brandl <georg@python.org>2012-09-29 07:27:15 (GMT)
commit99a247fd01c1cd780c0c3ee1116657627f1ee744 (patch)
tree319e33cb6612c3fafb2eb82e15c5e85e3d771e4f /Doc/library/lzma.rst
parent1628eaa5dc8892ff381ca7558cc7c8d80fac494d (diff)
parent8ed677db129171317b8ee7cd45b39b9013f5a2d6 (diff)
downloadcpython-99a247fd01c1cd780c0c3ee1116657627f1ee744.zip
cpython-99a247fd01c1cd780c0c3ee1116657627f1ee744.tar.gz
cpython-99a247fd01c1cd780c0c3ee1116657627f1ee744.tar.bz2
Merge with main repo default branch.
Diffstat (limited to 'Doc/library/lzma.rst')
-rw-r--r--Doc/library/lzma.rst12
1 files changed, 6 insertions, 6 deletions
diff --git a/Doc/library/lzma.rst b/Doc/library/lzma.rst
index 402fae2..f09fa08 100644
--- a/Doc/library/lzma.rst
+++ b/Doc/library/lzma.rst
@@ -335,15 +335,15 @@ Examples
Reading in a compressed file::
import lzma
- with lzma.LZMAFile("file.xz") as f:
- file_content = f.read()
+ with lzma.open("file.xz") as f:
+ file_content = f.read()
Creating a compressed file::
import lzma
data = b"Insert Data Here"
- with lzma.LZMAFile("file.xz", "w") as f:
- f.write(data)
+ with lzma.open("file.xz", "w") as f:
+ f.write(data)
Compressing data in memory::
@@ -367,7 +367,7 @@ Writing compressed data to an already-open file::
import lzma
with open("file.xz", "wb") as f:
f.write(b"This data will not be compressed\n")
- with lzma.LZMAFile(f, "w") as lzf:
+ with lzma.open(f, "w") as lzf:
lzf.write(b"This *will* be compressed\n")
f.write(b"Not compressed\n")
@@ -378,5 +378,5 @@ Creating a compressed file using a custom filter chain::
{"id": lzma.FILTER_DELTA, "dist": 5},
{"id": lzma.FILTER_LZMA2, "preset": 7 | lzma.PRESET_EXTREME},
]
- with lzma.LZMAFile("file.xz", "w", filters=my_filters) as f:
+ with lzma.open("file.xz", "w", filters=my_filters) as f:
f.write(b"blah blah blah")