Here are some useful functions that operate on objects of many types:
Returns a string containing the character whose
ASCII code is the integer
Compare two objects. The value returned
is zero if
are equal; negative if
and positive if
This may not work for all types, or when
have different types. It will certainly work for
numbers and strings.
Returns a list of all the names defined in
is a module, the list
shows the names of its members and functions. If the
argument is omitted, it returns a list of the names
defined in the local name space.
must be a sequence,
a function that takes
one argument and returns true or false (that is, a
result is a new sequence consisting of only those elements of
is true. If
None, the result is a sequence
consisting of the true elements of
see the definition of true-false values below.
Returns a dictionary whose keys are the names defined in the current module's global scope, and whose values are the values bound to those names.
Returns a dictionary whose keys are the names defined in the current local scope, and whose values are the values bound to those names.
Applies a function
to each member of a
returns a list of the results
[. If there are additional
sequence arguments, the function must take
as many arguments as there are sequences, and
element of the result is equal to
must be a string containing exactly one character.
The return value is the character code of that character as an
Apply the two-argument function
pairwise to the elements of sequence
Starts by computing
, and so forth
over the elements of
then returns the last
The optional third argument
is a starting value. If it is given, the function
starts by computing
, and then
continues as before.
Return a string containing a printable
You can abbreviate this function as
Returns the type of
more precisely, the type object
for the type of x.
There is one type object for each built-in type;
the type objects are named
long, and so forth, and are
summarized in the table of
You can compare type objects using expressions
if type(x) is list...”.
Returns a Unicode string containing the character whose
code is the integer