summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2006-07-27 22:49:38 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2006-07-27 22:49:38 (GMT)
commit752e28ad9fabd20907a55ae4a8846fdb4a977624 (patch)
treed55c8bf6545bce395636507bac0d059201b3e3b8 /Doc
parent4b6d53780dfea115361b3b7a6d87b47b3fb66a17 (diff)
downloadcpython-752e28ad9fabd20907a55ae4a8846fdb4a977624.zip
cpython-752e28ad9fabd20907a55ae4a8846fdb4a977624.tar.gz
cpython-752e28ad9fabd20907a55ae4a8846fdb4a977624.tar.bz2
Add example
Diffstat (limited to 'Doc')
-rw-r--r--Doc/lib/libmimetypes.tex14
1 files changed, 14 insertions, 0 deletions
diff --git a/Doc/lib/libmimetypes.tex b/Doc/lib/libmimetypes.tex
index 8e07768..6c46d6f 100644
--- a/Doc/lib/libmimetypes.tex
+++ b/Doc/lib/libmimetypes.tex
@@ -158,6 +158,20 @@ want more than one MIME-type database:
\versionadded{2.2}
\end{classdesc}
+An example usage of the module:
+
+\begin{verbatim}
+>>> import mimetypes
+>>> mimetypes.init()
+>>> mimetypes.knownfiles
+['/etc/mime.types', '/etc/httpd/mime.types', ... ]
+>>> mimetypes.suffix_map['.tgz']
+'.tar.gz'
+>>> mimetypes.encodings_map['.gz']
+'gzip'
+>>> mimetypes.types_map['.tgz']
+'application/x-tar-gz'
+\end{verbatim}
\subsection{MimeTypes Objects \label{mimetypes-objects}}