Presentation is loading. Please wait.

Presentation is loading. Please wait.

Python’s Standard library part I

Similar presentations


Presentation on theme: "Python’s Standard library part I"— Presentation transcript:

1 Python’s Standard library part I
Daniel Ciborowski CS 265 6/01/11

2 Operating System Interface
OS module provides dozens of functions for interacting with the operating system Shutil module provides a higher level interface that is easier to use for file and directory management

3 File Wildcards The glob module provides a function for making file lists from directory wildcard searches

4 Command Line Arguments
Utility scripts often process command line arguments, these arguments are stored in the sys module’s argv attribute as a list The following output results from running Python demo.py one two three

5 Error Output Redirection and Program Termination
Stderr is useful for emitting warnings and error messages The most direct way to terminate a script is to use Sys.ext()

6 String Pattern Matching
The re module provides regular expression tools for advanced string processing When only simple capabilities are needed, string methods are preferred because they are easier to read and debug

7 Mathematics The math modules gives access to the underlying C library functions for floating point math The random module provides tools for making random selections

8 Internet Access Number of modules for accessing the internet
Urllib2 for retriving data Smtplib for sending mail

9 Dates and Times Datetime modules supplies classes for manipulating dates and times in both simple and complex ways Focus of implementation is on efficient member extraction for output formatting

10 Data Compression Common data archiving and compression formats are directly supported by modules including zlib, gzip, bz2, zipfile, tarfile

11 Performance Measurement
Python provides measurement tools to determine relative performance of different approaches to the same problem

12 Quality Control The doctest module provides a tool for scanning a module and validating tests embedded in a program’s docstrings The unittest module allows a more comprehensive set of tests to be maintained in a separate file

13 Batteries Included Many larger packages are included that do not require user to have advanced knowledge Xmlrpclib and SimpleXMLRPCServer modules making implementing remote procedure calls simple, and do not require direct knowledge of XML The package includes a complete toolset for building complex messages, like attachments, and implementing internet encoding CSV module supports direct reads and writes in a common database formate


Download ppt "Python’s Standard library part I"

Similar presentations


Ads by Google