'''Tcl Equivalents of Python Modules''', a resource for [Python] programmers who have seen the light and are migrating [Tcl], maps Python modules to equivalent Tcl packages. [APN] A cautionary note - the Tcl column is empty not because the functionality is unavailable, but because no one finds it worthwhile to complete the table! ** The Python Standard Library ** %|Python Module|Python Code|Tcl Package|Tcl Code|Notes|% %|Built-in Types|||||% |Truth Value Testing||||| |Boolean Operations||||| |Comparisons||||| |Numeric Types||||| |Iterator Types||||| |Sequence Types||||| |Text Sequence Types||||| |Binary Sequence Types||||| |Set Types||||| |Mapping Types||||| |Context Manager Types||||| |Other Built-in Types||||| |Special Attributes||||| %|Built-in Exceptions|||||% %|Text Processing Services|||||% |string||[string]||| ||`'good morning'.capitalize()`||`[[string totitle] {good morning}`|| ||`'good morning'.startswith(somevar)`||`[string equal] -length [[string length $somevar] $somevar {good morning}]`|| |re||||| |difflib||||| |textwrap||||| |upicodeata||||| |stringprep||||| |readline||||| |rlcompleter||||| %|Binary Data Services|||||% |struct||||| |codecs||||| %|Data Types|||||% |datetime||[clock]||| ||`datetime.date.today()`||`[clock format] [[[clock] seconds] -format {%Y %m %d}`|| |calendar||||| |collections||||| |collections.abc||||| |heapq||||| |bisect||||| |array||||| |weakref||||| |types||||| |copy||||| |pprint||||| |reprlib||||| %|Numeric and Mathematical Modules|||||% |numbers||||| |math||||| |cmath||||| ||`phase(complex(-1.0, 0.0))`||`expr {atan2(0.0 ,-1.0)}`|| |decimal||||| |fractions||||| |random||||| ||`seed(100)`||`expr {srand(100)}`|also returns the first random number| %|Functional Programming Modules|||||% |itertools||||| |functools||||| |operator||||| %|File and Directory Access|||||% |os.path||||| |fileinput||||| |stat||||| |filecmp||||| |tempfile||||| |glob|`glob.glob('./[[0-9].*')`|[glob]|`glob {./[[0-9].*}`|| |fnmatch||||| |linecache||||| |shutil||||| |macpath||||| %|Data Persistence|||||% |pickle||||| |copyreg||||| |shelve||||| |marshal||||| |dbm||||| |sqlite3||[sqlite] ([Tcl Commands%|%built-in] from 8.6)||| %|Data Compression and Archiving|||||% |zlib|||`[zlib]` command, 8.6|| |gzip||||| |bz2||||| |lzma||||| |zipfile||||| |tarfile||[Tcllib tar]||| %|File Formats|||||% |csv||||| |configparser||||| |netrc||||| |xdrlib||||| |plistlib||||| %|Cryptographic Services|||||% |hashlib||||| |hmac||||| %|Generic Operating System Services|||||% |os||||| ||walk|[fileutil::traverse]||| |io||||| |time||||| |argparse||||| |optparse||||| |getopt||||| |loging||||| |loging.config||||| |loging.handlers||||| |getpass||||| |curses||||| |curses.textpad||||| |curses.ascii||||| |curses.panel||||| |platform||||| |errno||||| |ctypes||||| %|Concurrent Execution|||||% |threading||||| |multiprocessing||||| |The concurrent package||||| |concurrent.futures||||| |subprocess||||| |sched||||| |queue||||| |select||||| |dummy_thread||||| |_thread||||| |_dummy_thread||||| %|Interprocess Communication and Networking|||||% |socket||||| |ssl||||| |asyncore||||| |asynchat||||| |signal||||| |mmap||||| %|Internet Data Handling|||||% |email||||| |json||||| |mailcap||||| |mailbox||||| |mimetypes||||| |base64||||| |binhex||||| |binascii||||| |quopri||||| |uu||||| %|Structured Markup Processing Tools|||||% |html||||| |html.parser||||| |html.entities||||| |XML Processing Modules||||| |XML Vulnerabilites||||| |xml.etree.ElementTree||||| |xml.dom||||| |xml.dom.minidom||||| |xml.dom.pulldom||||| |xml.sax||||| |xml.sax.handler||||| |xml.sax.saxutils||||| |xml.sax.xmlreader||||| |xml.parsers.expat||||| %|Internet Protocols and Support|||||% |webbrowser||||| |cgi||||| |cgitb||||| |wsgiref||||| |urllib||||| |urllib.request||||| |urllib.response||||| |urllib.parse||||| |urllib.error||||| |urllib.rebotparser||||| |http||||| |http.client||||| |ftplib||||| |poplib||||| |imaplib||||| |nntplib||||| |smtplib||||| |smtpd||||| |telnetlib||||| |uuid||||| |socketserver||||| |http.server||||| |http.cookies||||| |http.cookie jar||||| |xmlrpc||||| |xmlrpc.client||||| |xmlrpc.server||||| |ipaddress||||| %|Multimedia Services|||||% |audioop||||| |aifc||||| |sunau||||| |wave||||| |chunk||||| |colorsys||||| |imghdr||||| |sndhdr||||| |ossaudiodev||||| %|Internationalization|||||% |gettext||||| |locale||||| %|Program Frameworks|||||% |turtle||||| |cmd||||| |shlex||||| %|Graphical User Interfaces with Tk|||||% |tkinter||||| |tkinter.ttk||||| |tkinter.tix||||| |tkinter.scrolledtext||||| |IDLE||||| |Other Graphical User Interface Packages||||| %|Development Tools|||||% |pydoc||||| |doctest||||| |unittest||||| |unittest.mock||||| |unittest.mock||||| |2to3||||| |test||||| |test.support||||| |venv||||| %|Debugging and Profiling|||||% |bdb||||| |faulthandler||||| |pdb||||| |the Python Debugger||||| |timeit||||| |trace||||| %|Python Runtime Services|||||% |sys||||| |sysconfig||||| |builtins||||| |_main_||||| |warnings||||| |contestlib||||| |abc||||| |atexit||||| |traceback||||| |_future_||||| |gc||||| |inspect||||| |site||||| |fpectl||||| |distutils||||| %|Custom Python Interpreters|||||% |code||||| |codeop||||| %|Importing Modules|||||% |imp||||| |zipimport||||| |pkgutil||||| |modulefinder||||| |runpy||||| |importlib||||| %|Python Language Services|||||% |parser||||| |ast||||| |symtable||||| |symbol||||| |token||||| |keyword||||| |tokenize||||| |tabnanny||||| |pyclbr||||| |py_compile||||| |compileall||||| |dis||||| |pickletools||||| %|Miscellaneous Services|||||% |formatter||||| %|MS Windows Specific Services|||||% |msilib||||| |msvcrt||||| |winreg||||| |winsound||||| %|Unix Specific Services|||||% |posix||||| |pwd||||| |spwd||||| |grp||||| |crypt||||| |termios||||| |tty||||| |pty||||| |fcntl||||| |pipes||||| |resource||||| |nis||||| |syslog||||| <> Python | Reference