Partial py3k-ification of Doc/library/: convert has_key references into either 'k in d' or __contains__; normalize raise statements; convert print statements into print function calls.
diff --git a/Doc/library/tarfile.rst b/Doc/library/tarfile.rst
index dcd62a0..4aabd81 100644
--- a/Doc/library/tarfile.rst
+++ b/Doc/library/tarfile.rst
@@ -601,13 +601,13 @@
import tarfile
tar = tarfile.open("sample.tar.gz", "r:gz")
for tarinfo in tar:
- print tarinfo.name, "is", tarinfo.size, "bytes in size and is",
+ print(tarinfo.name, "is", tarinfo.size, "bytes in size and is", end="")
if tarinfo.isreg():
- print "a regular file."
+ print("a regular file.")
elif tarinfo.isdir():
- print "a directory."
+ print("a directory.")
else:
- print "something else."
+ print("something else.")
tar.close()
How to create a tar archive with faked information::