FANDOM


The Python library consists of a number of modules that may be imported with a statement such as:

import math

Importing a module in this fashion makes its contents available within a namespace unique to that module; for the math module, this will make the sin function callable as math.sin(5).

To use the contents of a module within the global namespace, use:

from math import *

This makes the sin function callable as sin(5).

It is also possible to import a subset of the contents of a module:

from math import sin,cos,tan

This makes sin, cos, and tan available, but not the other elements of the math module.

List of modulesEdit

Modules available on all platformsEdit

These modules are in all platforms, and most are available in earlier versions of Python, as listed:

ModuleVersionNotes
__builtin__1.0
__future__2.3
__main__1.0
aifc1.1
anydbm1.5
array1.0
asynchat2.3
asyncore1.5.2
atexit2.0
audioop1.0
base641.5
BaseHTTPServer1.5
Bastion1.4
binascii1.3
binhex1.3
bisect1.5.1
bz22.3
calendar1.5.1
cgi1.2
CGIHTTPServer2.1
cgitb2.2
chunk1.0
cmath1.5
cmd1.5.1
code1.5
codecs1.6
codeop1.5.2
collections2.4
colorsys1.0
compileall1.5.2
compiler2.2
compiler.ast2.2
compiler.visitor2.2
ConfigParser, now configparser1.0
contextlib2.5
Cookie2.0
cookielib2.4
copy1.2
copy_reg, now copyreg1.5
cPickle1.5.1
cProfile2.5
cStringIO1.5.1
csv2.3
ctypes2.5
curses1.0
curses.ascii2.0
curses.panel2.1
curses.textpad2.0
curses.wrapper2.0
datetime2.3
decimal2.4
difflib2.1
dircache1.0
dis1.5
distutils2.2
distutils.archive_util2.4
distutils.bcppcompiler2.4
distutils.ccompiler2.4
distutils.cmd2.4
distutils.command2.4
distutils.command.bdist2.4
distutils.command.bdist_dumb2.4
distutils.command.bdist_packager2.4
distutils.command.bdist_rpm2.4
distutils.command.bdist_wininst2.4
distutils.command.build2.4
distutils.command.build_clib2.4
distutils.command.build_ext2.4
distutils.command.build_py2.4
distutils.command.build_scripts2.4
distutils.command.clean2.4
distutils.command.config2.4
distutils.command.install2.4
distutils.command.install_data2.4
distutils.command.install_headers2.4
distutils.command.install_lib2.4
distutils.command.install_scripts2.4
distutils.command.register2.4
distutils.command.sdist2.4
distutils.core2.4
distutils.cygwinccompiler2.4
distutils.debug2.4
distutils.dep_util2.4
distutils.dir_util2.4
distutils.dist2.4
distutils.emxccompiler2.4
distutils.errors2.4
distutils.extension2.4
distutils.fancy_getopt2.4
distutils.file_util2.4
distutils.filelist2.4
distutils.log2.4
distutils.msvccompiler2.4
distutils.mwerkscompiler2.4
distutils.spawn2.4
distutils.sysconfig2.4
distutils.text_file2.4
distutils.unixccompiler2.4
distutils.util2.4
distutils.version2.4
doctest2.1
DocXMLRPCServer2.3
dumbdbm1.5
dummy_thread2.3
dummy_threading2.3
email2.2
email.charset2.5email.Charset in 2.2 through 2.4
email.encoders2.5email.Encoders in 2.2 through 2.4
email.errors2.5email.Errors in 2.2 through 2.4
email.generator2.5email.Generator in 2.2 through 2.4
email.header2.5email.Header in 2.2 through 2.4
email.iterators2.5email.Iterators in 2.2 through 2.4
email.message2.5email.Message in 2.2 through 2.4
email.mime2.5
email.mime.audio2.5
email.mime.base2.5
email.mime.image2.5
email.mime.message2.5
email.mime.multipart2.5
email.mime.nonmultipart2.5
email.mime.text2.5
email.parser2.5email.Parser in 2.2 through 2.4
email.utils2.5email.Utils in 2.2 through 2.4
encodings.idna2.3
errno1.4
exceptions1.5.2
filecmp1.6
fileinput1.5.1
fnmatch1.5
formatter1.4
fpformat1.0
ftplib1.2
functools2.5
gc2.0
getopt1.0
getpass1.0
gettext2.0
glob1.5
gopherlib1.2, removed in Python 3.0
gzip1.5
hashlib2.5
heapq2.3
hmac2.2
hotshot2.3
hotshot.stats2.3
htmlentitydefs1.0
htmllib1.2
HTMLParser2.2
httplib1.2
imageop1.0
imaplib1.5.1
imghdr1.4
imp1.2
inspect2.1
itertools2.3
keyword1.5
linecache1.0
locale1.5
logging2.3
macpath1.0Undocumented in 1.6
mailbox1.5
mailcap1.5
marshal1.0
math1.0
md51.0, removed in Python 3.0
mhlib1.0
mimetools1.2
mimetypes1.5.1
MimeWriter1.0
mimify1.5
mmap2.0
modulefinder2.4
multifile1.5.1
mutex1.5.2
netrc1.5.2
new1.0
nntplib1.2
operator1.5
optparse2.3
os1.0
os.path1.0
parser1.3
pdb1.5.2
pickle1.2
pickletools2.4
pkgutil2.3
platform2.4
poplib1.5.1
pprint1.5
profile1.0
pstats1.5.2
py_compile1.5.2
pyclbr1.5.2
pydoc2.2
Queue, now queue1.5
quopri1.5
random1.5
re1.5
repr1.5.2
rexec1.4
rfc8221.2
rgbimg1.0
rlcompleter1.5.2Listed as Unix-only from 2.0 through 2.4
robotparser1.0
runpy2.5
sched1.0
select1.0
sets2.3
sgmllib1.2
sha1.5.2
shelve1.2
shlex1.5.2
shutil1.0
signal1.2
SimpleHTTPServer1.0
SimpleXMLRPCServer2.2
site1.5
smtpd2.4
smtplib1.5.1
sndhdr1.5.2
socket1.0
SocketServer, now socketserver1.5
sqlite32.5
stat1.0
statvfs1.0
string1.0
StringIO1.5
stringprep2.3
struct1.0
subprocess2.4
sunau1.0
symbol1.5
sys1.0
tabnanny1.6
tarfile2.3
telnetlib1.5.2
tempfile1.2
test2.3
test.test_support2.3
textwrap2.3
thread1.0
threading1.5.1
time1.0
timeit2.3
Tix2.2
Tkinter2.2
token1.5
tokenize1.0
trace2.5
traceback1.2
types1.2
unicodedata2.0
unittest2.1
urllib1.2
urllib22.1
urlparse1.2
user1.5
UserDict1.5
UserList1.5
UserString1.0
uu1.3
uuid2.5
warnings2.1
wave1.5.2
weakref2.1
webbrowser2.0
whichdb1.5
wsgiref2.5
wsgiref.handlers2.5
wsgiref.headers2.5
wsgiref.simple_server2.5
wsgiref.util2.5
wsgiref.validate2.5
xdrlib1.4
xml.dom2.1
xml.dom.minidom2.1
xml.dom.pulldom2.1
xml.etree.ElementTree2.5
xml.parsers.expat2.0
xml.sax2.0
xml.sax.handler2.0
xml.sax.saxutils2.0
xml.sax.xmlreader2.0
xmlrpclib2.2
zipfile2.0
zipimport2.3
zlib1.5

Modules available on UnixEdit

Modules available on all Unix-like systemsEdit

The following additional modules are available in Unix, including Linux, FreeBSD and others:

ModuleVersionNotes
bsddb1.5.2, removed in Python 3.0Also on Windows
commands1.5
crypt1.4
dbhash1.5.2Also on Windows
dbm1.0
dl1.5.2
fcntl1.1
fpectl2.1
gdbm1.1
grp1.0
pipes1.5.2
popen21.5.1Also on Windows since 2.0
posix1.0
posixfile1.1
pwd1.0
readline1.6
resource1.5
spwd2.5
syslog1.3
termios1.2
tty1.5.2

Modules available on IRIXEdit

These modules are available on SGI's IRIX system. They deal mainly with multimedia issues:

ModuleVersionNotes
al1.0
AL1.0
cd1.2
DEVICE1.0
fl1.0
FL1.0
flp1.0
fm1.0
gl1.0
GL1.0
imgfile1.0
jpeg1.0
pty1.5.2Also on Linux

Modules available on WindowsEdit

The following additional modules are available in Windows:

ModuleVersionNotes
bsddb1.5.2, removed in Python 3.0Also on Unix
dbhash1.5.2Also on Unix
msilib2.5
msvcrt1.5.2
popen22.0Also on Unix since 1.5.2
_winreg2.0Renamed to winreg as of Python 3.0
winsound1.5.2

Modules available on MacOSEdit

The following additional modules are available in MacOS:

ModuleVersionNotes
aepack2.0
aetools2.3
aetypes2.0
applesingle2.2
autoGIL2.3
buildtools2.0
Carbon.AE2.2
Carbon.AH2.3
Carbon.App2.2
Carbon.CaronEvt2.3
Carbon.CF2.2
Carbon.CG2.3
Carbon.Cm2.2
Carbon.Ctl2.2
Carbon.Dlg2.2
Carbon.Evt2.2
Carbon.Fm2.2
Carbon.Folder2.3
Carbon.Help2.2
Carbon.List2.2
Carbon.Menu2.2
Carbon.Mlte2.2
Carbon.Qd2.2
Carbon.Qdoffs2.2
Carbon.Qt2.2
Carbon.Res2.2
Carbon.Scrap2.2
Carbon.Snd2.2
Carbon.TE2.2
Carbon.Win2.2
cfmfile2.0
ColorPicker2.1
EasyDialogs1.3
findertools1.4
FrameWork1.3
gensuitemodule2.3
ic1.5
icopen2.0
macerrors2.0
macfs1.2
MacOS1.3
macostools1.3
macresource2.2
MiniAEFrame1.4
Nav2.2
PixMapWrapper2.0
videoreader2.2
W2.0

Obsolete modules Edit

The following modules were present in earlier versions of Python, but are no longer present in Python 2.5:

NameVersionsNotes
cmp1.5.2 only
cmpcache1.5.2 only
mpz1.0 through 2.3Use long integers instead.
regex1.0 through 1.6Use re instead.
regsub1.0 through 1.6
rotor1.0 through 2.3
statcache1.0 through 2.4
whrandom1.0 through 2.4
xmllib1.5 through 2.4
xreadlines2.1 through 2.3

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.