Operations on all sequence types lists tuples strings

True if an item of s is equal to x, else False False if an item of s is equal to x, else True Slice of s from i (included) to j(excluded). Optional step value, possibly negative (default 1). returns number of i's for which s i x returns smallest i such that s i x. start and stop limit search to only part of the sequence. 2.4 Returns an iterator on s in reverse order. s must be a sequence, not an iterator (use reversed(list (s)) in this case. PEP 322 sorted(iterable , cmp , cmp cmpFct , key...

Operations on mappings dictionaries type diet

Creates a dictionary init with the keyword args Creates a dictionary init with (key, value) pairs provided by iterable. Creates a dictionary which is a copy of dictionary d. Class method to create a dictionary with keys provided by iterator, and all values set to value. A copy of d's list of (key, item) pairs for k, v in d2. items () d1 k v Since 2.4, update(**kwargs) and update(iterable) may also be used. d k if k in d, else defaultval (also setting it) Returns an iterator over (key, value)...

Operations on strings types str unicode

These string methods largely (but not completely) supersede the functions available in the string module. The str and unicode types share a common base class basestring. These string methods largely (but not completely) supersede the functions available in the string module. The str and unicode types share a common base class basestring. Returns a copy of s with its first character capitalized, and the rest of the characters lowercased. Returns a copy of s centered in a string of length width,...

Operators and their evaluation order

Operators and their evaluation order Tuple, list & dict. creation string conv. indexing & slicing attributes, fct calls x< y x< y x> y x> y x y x y x< > y x is y x is not y x in s x not in s Alternate names are defined in module operator (e.g._add__and add for +) Most operators are overridable

Sys

System-specific parameters and functions. The list of command line arguments passed to a Python script. sys. argv 0 is the script name. A list of strings giving the names of all modules written in C that are linked into this interpreter. Native byte order, either 'big' -endian or 'little' -endian . How often to check for thread switches or signals measured in number of virtual machine instructions . Deprecated since , use method getcheckinterval instead. A string containing the copyright...

List of modules and packages in base distribution

Built-ins and content of python Lib directory. The subdirectory Lib site-packages contains platform-specific packages and modules. Main distributions Windows, Unix , some OS specific modules may be missing Provide direct access to all ' built-in' identifiers of Python, e.g._builtin_.open is the full name for the built-in function open . Future statement definitions. Used to progressively introduce new features in the language. Represent the otherwise anonymous scope in which the interpreter's...

Posixpath

Do not import this module directly, import os instead and refer to this module as os.path. e.g. os.path.exists p Returns absolute path for path, taking current working dir in account. Returns the longuest path prefix taken character-by-character that is a prefix of all paths in list or '' if list empty . directory and name parts of path. See also split. True if path is the path of an existing file or directory. See also lexists. Returns a copy of path with expansion done. Returns string that is...