diff options
author | Nadeem Vawda <nadeem.vawda@gmail.com> | 2012-09-23 16:20:23 (GMT) |
---|---|---|
committer | Nadeem Vawda <nadeem.vawda@gmail.com> | 2012-09-23 16:20:23 (GMT) |
commit | 5011244be0f12ab51ca318bdc409d5df5f8c7914 (patch) | |
tree | fb84bd2f718c3e91e548df0d405751086b9efba2 | |
parent | 667a13bf2a6a47b84cd63ef82e49ae26fc9529eb (diff) | |
download | cpython-5011244be0f12ab51ca318bdc409d5df5f8c7914.zip cpython-5011244be0f12ab51ca318bdc409d5df5f8c7914.tar.gz cpython-5011244be0f12ab51ca318bdc409d5df5f8c7914.tar.bz2 |
Prefer lzma.open() over lzma.LZMAFile() in lzma module documentation.
-rw-r--r-- | Doc/library/lzma.rst | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Doc/library/lzma.rst b/Doc/library/lzma.rst index 4c637db..f09fa08 100644 --- a/Doc/library/lzma.rst +++ b/Doc/library/lzma.rst @@ -335,14 +335,14 @@ Examples Reading in a compressed file:: import lzma - with lzma.LZMAFile("file.xz") as f: + 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: + 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") |