Members
- abs
- all
- any
- bool
- dict
- dir
- enumerate
- fail
- float
- getattr
- hasattr
- hash
- int
- len
- list
- max
- min
- range
- repr
- reversed
- set
- sorted
- str
- tuple
- type
- zip
abs
Parameters
ParameterDescriptionxint; or float;
required
A number (int or float)
all
Parameters
ParameterDescriptionelements
iterable;
required
A collection of elements.
any
Parameters
ParameterDescriptionelements
iterable;
required
A collection of elements.
bool
False if the object is None, False, an empty string ( ""), the number 0, or an empty collection (e.g. (), []). Otherwise, it returns True.
Parameters
ParameterDescriptionx
default is False
The variable to convert.
dict
Parameters
ParameterDescriptionpairs
default is []
A dict, or an iterable whose elements are each of length 2 (key, value).
kwargs
required
Dictionary of additional entries.
dir
Parameters
ParameterDescriptionx
required
The object to check.
enumerate
Parameters
ParameterDescriptionlist
required
input sequence.
startint;
default is 0
start index.
fail
Parameters
ParameterDescriptionmsg
default is None
Deprecated: use positional arguments instead. This argument acts like an implicit leading positional argument.
attrstring; or None;
default is None
Deprecated. Causes an optional prefix containing this string to be added to the error message.
sepstring;
default is " "
The separator string between the objects, default is space (” ”).
args
required
A list of values, formatted with debugPrint (which is equivalent to str by default) and joined with sep (defaults to ” ”), that appear in the error message.
float
- If
xis already a float,floatreturns it unchanged. - If
xis a bool,floatreturns 1.0 for True and 0.0 for False. - If
xis an int,floatreturns the nearest finite floating-point value to x, or an error if the magnitude is too large. - If
xis a string, it must be a valid floating-point literal, or be equal (ignoring case) toNaN,Inf, orInfinity, optionally preceded by a+or-sign.
float() returns 0.0.
Parameters
ParameterDescriptionxstring; or bool; or int; or float;
default is unbound
The value to convert.
getattr
default (if specified) or raises an error. getattr(x, "foobar") is equivalent to x.foobar.
Parameters
ParameterDescriptionx
required
The struct whose attribute is accessed.
namestring;
required
The name of the struct attribute.
default
default is unbound
The default value to return in case the struct doesn’t have an attribute of the given name.
hasattr
x has an attribute or method of the given name, otherwise False. Example:
Parameters
ParameterDescriptionx
required
The object to check.
namestring;
required
The name of the attribute.
hash
String.hashCode(), namely:
Parameters
ParameterDescriptionvaluestring;
required
String value to hash.
int
- If
xis already an int,intreturns it unchanged. - If
xis a bool,intreturns 1 for True and 0 for False. - If
xis a string, it must have the format<sign><prefix><digits>.<sign>is either"+","-", or empty (interpreted as positive).<digits>are a sequence of digits from 0 up tobase- 1, where the letters a-z (or equivalently, A-Z) are used as digits for 10-35. In the case wherebaseis 2/8/16,<prefix>is optional and may be 0b/0o/0x (or equivalently, 0B/0O/0X) respectively; if thebaseis any other value besides these bases or the special value 0, the prefix must be empty. In the case wherebaseis 0, the string is interpreted as an integer literal, in the sense that one of the bases 2/8/10/16 is chosen depending on which prefix if any is used. Ifbaseis 0, no prefix is used, and there is more than one digit, the leading digit cannot be 0; this is to avoid confusion between octal and decimal. The magnitude of the number represented by the string must be within the allowed range for the int type. - If
xis a float,intreturns the integer value of the float, rounding towards zero. It is an error if x is non-finite (NaN or infinity).
x is any other type, or if the value is a string not satisfying the above format. Unlike Python’s int function, this function does not allow zero arguments, and does not allow extraneous whitespace for string arguments.
Examples:
Parameters
ParameterDescriptionxstring; or bool; or int; or float;
required
The string to convert.
baseint;
default is unbound
The base used to interpret a string value; defaults to 10. Must be between 2 and 36 (inclusive), or 0 to detect the base as if x were an integer literal. This parameter must not be supplied if the value is not a string.
len
Parameters
ParameterDescriptionx
iterable; or string;
required
The value whose length to report.
list
Parameters
ParameterDescriptionx
iterable;
default is []
The object to convert.
max
Parameters
ParameterDescriptionkey
callable; or None;
default is None
An optional function applied to each element before comparison.
args
required
The elements to be checked.
min
Parameters
ParameterDescriptionkey
callable; or None;
default is None
An optional function applied to each element before comparison.
args
required
The elements to be checked.
args as debug output. It will be prefixed with the string "DEBUG" and the location (file and line number) of this call. The exact way in which the arguments are converted to strings is unspecified and may change at any time. In particular, it may be different from (and more detailed than) the formatting done by str() and repr().
Using print in production code is discouraged due to the spam it creates for users. For deprecations, prefer a hard error using fail() whenever possible.
Parameters
ParameterDescriptionsepstring;
default is " "
The separator string between the objects, default is space (” ”).
args
required
The objects to print.
range
start to stop, using a step increment. If a single argument is provided, items will range from 0 to that element.
Parameters
ParameterDescriptionstart_or_stopint;
required
Value of the start element if stop is provided, otherwise value of stop and the actual start is 0
stopint;
default is unbound
optional index of the first item not to be included in the resulting list; generation of the list stops before stop is reached.
stepint;
default is 1
The increment (default is 1). It may be negative.
repr
Parameters
ParameterDescriptionx
required
The object to convert.
reversed
Parameters
ParameterDescriptionsequence
iterable;
required
The iterable sequence (e.g. list) to be reversed.
set
set() returns a new empty set.
For example,
Parameters
ParameterDescriptionelements
iterable;
default is []
An iterable of hashable values.
sorted
Parameters
ParameterDescriptioniterable
iterable;
required
The iterable sequence to sort.
key
callable; or None;
default is None
An optional function applied to each element before comparison.
reversebool;
default is False
Return results in descending order.
str
Parameters
ParameterDescriptionx
required
The object to convert.
tuple
Parameters
ParameterDescriptionx
iterable;
default is ()
The object to convert.
type
Parameters
ParameterDescriptionx
required
The object to check type of.
zip
list of tuple s, where the i-th tuple contains the i-th element from each of the argument sequences or iterables. The list has the size of the shortest input. With a single iterable argument, it returns a list of 1-tuples. With no arguments, it returns an empty list. Examples:
Parameters
ParameterDescriptionargs
required
lists to zip.