💾 Archived View for tris.fyi › pydoc › builtins captured on 2023-01-29 at 02:45:46. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2022-07-16)
-=-=-=-=-=-=-
Built-in functions, exceptions, and other objects. Noteworthy: None is the `nil' object; Ellipsis represents `...' in slices.
Base class for arithmetic errors.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Assertion failed.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Attribute not found.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
name = <member 'name' of 'AttributeError' objects> attribute name
obj = <member 'obj' of 'AttributeError' objects> object
Common base class for all exceptions
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
I/O operation would block.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
characters_written = <attribute 'characters_written' of 'OSError' objects>
errno = <member 'errno' of 'OSError' objects> POSIX exception code
filename = <member 'filename' of 'OSError' objects> exception filename
filename2 = <member 'filename2' of 'OSError' objects> second exception filename
strerror = <member 'strerror' of 'OSError' objects> exception strerror
Broken pipe.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
characters_written = <attribute 'characters_written' of 'OSError' objects>
errno = <member 'errno' of 'OSError' objects> POSIX exception code
filename = <member 'filename' of 'OSError' objects> exception filename
filename2 = <member 'filename2' of 'OSError' objects> second exception filename
strerror = <member 'strerror' of 'OSError' objects> exception strerror
Buffer error.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Base class for warnings about bytes and buffer related problems, mostly related to conversion from str or comparing to str.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Child process error.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
characters_written = <attribute 'characters_written' of 'OSError' objects>
errno = <member 'errno' of 'OSError' objects> POSIX exception code
filename = <member 'filename' of 'OSError' objects> exception filename
filename2 = <member 'filename2' of 'OSError' objects> second exception filename
strerror = <member 'strerror' of 'OSError' objects> exception strerror
Connection aborted.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
characters_written = <attribute 'characters_written' of 'OSError' objects>
errno = <member 'errno' of 'OSError' objects> POSIX exception code
filename = <member 'filename' of 'OSError' objects> exception filename
filename2 = <member 'filename2' of 'OSError' objects> second exception filename
strerror = <member 'strerror' of 'OSError' objects> exception strerror
Connection error.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
characters_written = <attribute 'characters_written' of 'OSError' objects>
errno = <member 'errno' of 'OSError' objects> POSIX exception code
filename = <member 'filename' of 'OSError' objects> exception filename
filename2 = <member 'filename2' of 'OSError' objects> second exception filename
strerror = <member 'strerror' of 'OSError' objects> exception strerror
Connection refused.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
characters_written = <attribute 'characters_written' of 'OSError' objects>
errno = <member 'errno' of 'OSError' objects> POSIX exception code
filename = <member 'filename' of 'OSError' objects> exception filename
filename2 = <member 'filename2' of 'OSError' objects> second exception filename
strerror = <member 'strerror' of 'OSError' objects> exception strerror
Connection reset.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
characters_written = <attribute 'characters_written' of 'OSError' objects>
errno = <member 'errno' of 'OSError' objects> POSIX exception code
filename = <member 'filename' of 'OSError' objects> exception filename
filename2 = <member 'filename2' of 'OSError' objects> second exception filename
strerror = <member 'strerror' of 'OSError' objects> exception strerror
Base class for warnings about deprecated features.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Read beyond end of file.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Base class for warnings about encodings.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Base class for I/O related errors.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
characters_written = <attribute 'characters_written' of 'OSError' objects>
errno = <member 'errno' of 'OSError' objects> POSIX exception code
filename = <member 'filename' of 'OSError' objects> exception filename
filename2 = <member 'filename2' of 'OSError' objects> second exception filename
strerror = <member 'strerror' of 'OSError' objects> exception strerror
Common base class for all non-exit exceptions.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
File already exists.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
characters_written = <attribute 'characters_written' of 'OSError' objects>
errno = <member 'errno' of 'OSError' objects> POSIX exception code
filename = <member 'filename' of 'OSError' objects> exception filename
filename2 = <member 'filename2' of 'OSError' objects> second exception filename
strerror = <member 'strerror' of 'OSError' objects> exception strerror
File not found.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
characters_written = <attribute 'characters_written' of 'OSError' objects>
errno = <member 'errno' of 'OSError' objects> POSIX exception code
filename = <member 'filename' of 'OSError' objects> exception filename
filename2 = <member 'filename2' of 'OSError' objects> second exception filename
strerror = <member 'strerror' of 'OSError' objects> exception strerror
Floating point operation failed.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Base class for warnings about constructs that will change semantically in the future.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Request that a generator exit.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Base class for I/O related errors.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
characters_written = <attribute 'characters_written' of 'OSError' objects>
errno = <member 'errno' of 'OSError' objects> POSIX exception code
filename = <member 'filename' of 'OSError' objects> exception filename
filename2 = <member 'filename2' of 'OSError' objects> second exception filename
strerror = <member 'strerror' of 'OSError' objects> exception strerror
Import can't find module, or can't find name in module.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
msg = <member 'msg' of 'ImportError' objects> exception message
name = <member 'name' of 'ImportError' objects> module name
path = <member 'path' of 'ImportError' objects> module path
Base class for warnings about probable mistakes in module imports
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Improper indentation.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
end_lineno = <member 'end_lineno' of 'SyntaxError' objects> exception end lineno
end_offset = <member 'end_offset' of 'SyntaxError' objects> exception end offset
filename = <member 'filename' of 'SyntaxError' objects> exception filename
lineno = <member 'lineno' of 'SyntaxError' objects> exception lineno
msg = <member 'msg' of 'SyntaxError' objects> exception msg
offset = <member 'offset' of 'SyntaxError' objects> exception offset
print_file_and_line = <member 'print_file_and_line' of 'SyntaxError' objects> exception print_file_and_line
text = <member 'text' of 'SyntaxError' objects> exception text
Sequence index out of range.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Interrupted by signal.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
characters_written = <attribute 'characters_written' of 'OSError' objects>
errno = <member 'errno' of 'OSError' objects> POSIX exception code
filename = <member 'filename' of 'OSError' objects> exception filename
filename2 = <member 'filename2' of 'OSError' objects> second exception filename
strerror = <member 'strerror' of 'OSError' objects> exception strerror
Operation doesn't work on directories.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
characters_written = <attribute 'characters_written' of 'OSError' objects>
errno = <member 'errno' of 'OSError' objects> POSIX exception code
filename = <member 'filename' of 'OSError' objects> exception filename
filename2 = <member 'filename2' of 'OSError' objects> second exception filename
strerror = <member 'strerror' of 'OSError' objects> exception strerror
Mapping key not found.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Program interrupted by user.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Base class for lookup errors.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Out of memory.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Module not found.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
msg = <member 'msg' of 'ImportError' objects> exception message
name = <member 'name' of 'ImportError' objects> module name
path = <member 'path' of 'ImportError' objects> module path
Name not found globally.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
name = <member 'name' of 'NameError' objects> name
Operation only works on directories.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
characters_written = <attribute 'characters_written' of 'OSError' objects>
errno = <member 'errno' of 'OSError' objects> POSIX exception code
filename = <member 'filename' of 'OSError' objects> exception filename
filename2 = <member 'filename2' of 'OSError' objects> second exception filename
strerror = <member 'strerror' of 'OSError' objects> exception strerror
Method or function hasn't been implemented yet.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Base class for I/O related errors.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
characters_written = <attribute 'characters_written' of 'OSError' objects>
errno = <member 'errno' of 'OSError' objects> POSIX exception code
filename = <member 'filename' of 'OSError' objects> exception filename
filename2 = <member 'filename2' of 'OSError' objects> second exception filename
strerror = <member 'strerror' of 'OSError' objects> exception strerror
Result too large to be represented.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Base class for warnings about features which will be deprecated in the future.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Not enough permissions.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
characters_written = <attribute 'characters_written' of 'OSError' objects>
errno = <member 'errno' of 'OSError' objects> POSIX exception code
filename = <member 'filename' of 'OSError' objects> exception filename
filename2 = <member 'filename2' of 'OSError' objects> second exception filename
strerror = <member 'strerror' of 'OSError' objects> exception strerror
Process not found.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
characters_written = <attribute 'characters_written' of 'OSError' objects>
errno = <member 'errno' of 'OSError' objects> POSIX exception code
filename = <member 'filename' of 'OSError' objects> exception filename
filename2 = <member 'filename2' of 'OSError' objects> second exception filename
strerror = <member 'strerror' of 'OSError' objects> exception strerror
Recursion limit exceeded.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Weak ref proxy used after referent went away.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Base class for warnings about resource usage.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Unspecified run-time error.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Base class for warnings about dubious runtime behavior.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Signal the end from iterator.__anext__().
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Signal the end from iterator.__next__().
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
value = <member 'value' of 'StopIteration' objects> generator return value
Invalid syntax.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
end_lineno = <member 'end_lineno' of 'SyntaxError' objects> exception end lineno
end_offset = <member 'end_offset' of 'SyntaxError' objects> exception end offset
filename = <member 'filename' of 'SyntaxError' objects> exception filename
lineno = <member 'lineno' of 'SyntaxError' objects> exception lineno
msg = <member 'msg' of 'SyntaxError' objects> exception msg
offset = <member 'offset' of 'SyntaxError' objects> exception offset
print_file_and_line = <member 'print_file_and_line' of 'SyntaxError' objects> exception print_file_and_line
text = <member 'text' of 'SyntaxError' objects> exception text
Base class for warnings about dubious syntax.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Internal error in the Python interpreter. Please report this to the Python maintainer, along with the traceback, the Python version, and the hardware/OS platform and version.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Request to exit from the interpreter.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
code = <member 'code' of 'SystemExit' objects> exception code
Improper mixture of spaces and tabs.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
end_lineno = <member 'end_lineno' of 'SyntaxError' objects> exception end lineno
end_offset = <member 'end_offset' of 'SyntaxError' objects> exception end offset
filename = <member 'filename' of 'SyntaxError' objects> exception filename
lineno = <member 'lineno' of 'SyntaxError' objects> exception lineno
msg = <member 'msg' of 'SyntaxError' objects> exception msg
offset = <member 'offset' of 'SyntaxError' objects> exception offset
print_file_and_line = <member 'print_file_and_line' of 'SyntaxError' objects> exception print_file_and_line
text = <member 'text' of 'SyntaxError' objects> exception text
Timeout expired.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
characters_written = <attribute 'characters_written' of 'OSError' objects>
errno = <member 'errno' of 'OSError' objects> POSIX exception code
filename = <member 'filename' of 'OSError' objects> exception filename
filename2 = <member 'filename2' of 'OSError' objects> second exception filename
strerror = <member 'strerror' of 'OSError' objects> exception strerror
Inappropriate argument type.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Local name referenced but not bound to a value.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
name = <member 'name' of 'NameError' objects> name
Unicode decoding error.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
encoding = <member 'encoding' of 'UnicodeDecodeError' objects> exception encoding
end = <member 'end' of 'UnicodeDecodeError' objects> exception end
object = <member 'object' of 'UnicodeDecodeError' objects> exception object
reason = <member 'reason' of 'UnicodeDecodeError' objects> exception reason
start = <member 'start' of 'UnicodeDecodeError' objects> exception start
Unicode encoding error.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
encoding = <member 'encoding' of 'UnicodeEncodeError' objects> exception encoding
end = <member 'end' of 'UnicodeEncodeError' objects> exception end
object = <member 'object' of 'UnicodeEncodeError' objects> exception object
reason = <member 'reason' of 'UnicodeEncodeError' objects> exception reason
start = <member 'start' of 'UnicodeEncodeError' objects> exception start
Unicode related error.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Unicode translation error.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
encoding = <member 'encoding' of 'UnicodeTranslateError' objects> exception encoding
end = <member 'end' of 'UnicodeTranslateError' objects> exception end
object = <member 'object' of 'UnicodeTranslateError' objects> exception object
reason = <member 'reason' of 'UnicodeTranslateError' objects> exception reason
start = <member 'start' of 'UnicodeTranslateError' objects> exception start
Base class for warnings about Unicode related problems, mostly related to conversion problems.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Base class for warnings generated by user code.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Inappropriate argument value (of correct type).
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Base class for warning categories.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Second argument to a division or modulo operation was zero.
with_traceback(...) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
bool(x) -> bool Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.
as_integer_ratio(self, /) Return integer ratio. Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator. >>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
bit_count(self, /) Number of ones in the binary representation of the absolute value of self. Also known as the population count. >>> bin(13) '0b1101' >>> (13).bit_count() 3
bit_length(self, /) Number of bits necessary to represent self in binary. >>> bin(37) '0b100101' >>> (37).bit_length() 6
conjugate(...) Returns self, the complex conjugate of any int.
from_bytes(bytes, byteorder, *, signed=False) Return the integer represented by the given array of bytes. bytes Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol. byteorder The byte order used to represent the integer. If byteorder is 'big', the most significant byte is at the beginning of the byte array. If byteorder is 'little', the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder' as the byte order value. signed Indicates whether two's complement is used to represent the integer.
to_bytes(self, /, length, byteorder, *, signed=False) Return an array of bytes representing an integer. length Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. byteorder The byte order used to represent the integer. If byteorder is 'big', the most significant byte is at the beginning of the byte array. If byteorder is 'little', the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder' as the byte order value. signed Determines whether two's complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
denominator = <attribute 'denominator' of 'int' objects> the denominator of a rational number in lowest terms
imag = <attribute 'imag' of 'int' objects> the imaginary part of a complex number
numerator = <attribute 'numerator' of 'int' objects> the numerator of a rational number in lowest terms
real = <attribute 'real' of 'int' objects> the real part of a complex number
bytearray(iterable_of_ints) -> bytearray bytearray(string, encoding[, errors]) -> bytearray bytearray(bytes_or_buffer) -> mutable copy of bytes_or_buffer bytearray(int) -> bytes array of size given by the parameter initialized with null bytes bytearray() -> empty bytes array Construct a mutable bytearray object from: - an iterable yielding integers in range(256) - a text string encoded using the specified encoding - a bytes or a buffer object - any object implementing the buffer API. - an integer
append(self, item, /) Append a single item to the end of the bytearray. item The item to be appended.
capitalize(...) B.capitalize() -> copy of B Return a copy of B with only its first character capitalized (ASCII) and the rest lower-cased.
center(self, width, fillchar=b' ', /) Return a centered string of length width. Padding is done using the specified fill character.
clear(self, /) Remove all items from the bytearray.
copy(self, /) Return a copy of B.
count(...) B.count(sub[, start[, end]]) -> int Return the number of non-overlapping occurrences of subsection sub in bytes B[start:end]. Optional arguments start and end are interpreted as in slice notation.
decode(self, /, encoding='utf-8', errors='strict') Decode the bytearray using the codec registered for encoding. encoding The encoding with which to decode the bytearray. errors The error handling scheme to use for the handling of decoding errors. The default is 'strict' meaning that decoding errors raise a UnicodeDecodeError. Other possible values are 'ignore' and 'replace' as well as any other name registered with codecs.register_error that can handle UnicodeDecodeErrors.
endswith(...) B.endswith(suffix[, start[, end]]) -> bool Return True if B ends with the specified suffix, False otherwise. With optional start, test B beginning at that position. With optional end, stop comparing B at that position. suffix can also be a tuple of bytes to try.
expandtabs(self, /, tabsize=8) Return a copy where all tab characters are expanded using spaces. If tabsize is not given, a tab size of 8 characters is assumed.
extend(self, iterable_of_ints, /) Append all the items from the iterator or sequence to the end of the bytearray. iterable_of_ints The iterable of items to append.
find(...) B.find(sub[, start[, end]]) -> int Return the lowest index in B where subsection sub is found, such that sub is contained within B[start,end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure.
fromhex(string, /) Create a bytearray object from a string of hexadecimal numbers. Spaces between two numbers are accepted. Example: bytearray.fromhex('B9 01EF') -> bytearray(b'\\xb9\\x01\\xef')
hex(...) Create a string of hexadecimal numbers from a bytearray object. sep An optional single character or byte to separate hex bytes. bytes_per_sep How many bytes between separators. Positive values count from the right, negative values count from the left. Example: >>> value = bytearray([0xb9, 0x01, 0xef]) >>> value.hex() 'b901ef' >>> value.hex(':') 'b9:01:ef' >>> value.hex(':', 2) 'b9:01ef' >>> value.hex(':', -2) 'b901:ef'
index(...) B.index(sub[, start[, end]]) -> int Return the lowest index in B where subsection sub is found, such that sub is contained within B[start,end]. Optional arguments start and end are interpreted as in slice notation. Raises ValueError when the subsection is not found.
insert(self, index, item, /) Insert a single item into the bytearray before the given index. index The index where the value is to be inserted. item The item to be inserted.
isalnum(...) B.isalnum() -> bool Return True if all characters in B are alphanumeric and there is at least one character in B, False otherwise.
isalpha(...) B.isalpha() -> bool Return True if all characters in B are alphabetic and there is at least one character in B, False otherwise.
isascii(...) B.isascii() -> bool Return True if B is empty or all characters in B are ASCII, False otherwise.
isdigit(...) B.isdigit() -> bool Return True if all characters in B are digits and there is at least one character in B, False otherwise.
islower(...) B.islower() -> bool Return True if all cased characters in B are lowercase and there is at least one cased character in B, False otherwise.
isspace(...) B.isspace() -> bool Return True if all characters in B are whitespace and there is at least one character in B, False otherwise.
istitle(...) B.istitle() -> bool Return True if B is a titlecased string and there is at least one character in B, i.e. uppercase characters may only follow uncased characters and lowercase characters only cased ones. Return False otherwise.
isupper(...) B.isupper() -> bool Return True if all cased characters in B are uppercase and there is at least one cased character in B, False otherwise.
join(self, iterable_of_bytes, /) Concatenate any number of bytes/bytearray objects. The bytearray whose method is called is inserted in between each pair. The result is returned as a new bytearray object.
ljust(self, width, fillchar=b' ', /) Return a left-justified string of length width. Padding is done using the specified fill character.
lower(...) B.lower() -> copy of B Return a copy of B with all ASCII characters converted to lowercase.
lstrip(self, bytes=None, /) Strip leading bytes contained in the argument. If the argument is omitted or None, strip leading ASCII whitespace.
maketrans(frm, to, /) Return a translation table useable for the bytes or bytearray translate method. The returned table will be one where each byte in frm is mapped to the byte at the same position in to. The bytes objects frm and to must be of the same length.
partition(self, sep, /) Partition the bytearray into three parts using the given separator. This will search for the separator sep in the bytearray. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it as new bytearray objects. If the separator is not found, returns a 3-tuple containing the copy of the original bytearray object and two empty bytearray objects.
pop(self, index=-1, /) Remove and return a single item from B. index The index from where to remove the item. -1 (the default value) means remove the last item. If no index argument is given, will pop the last item.
remove(self, value, /) Remove the first occurrence of a value in the bytearray. value The value to remove.
removeprefix(self, prefix, /) Return a bytearray with the given prefix string removed if present. If the bytearray starts with the prefix string, return bytearray[len(prefix):]. Otherwise, return a copy of the original bytearray.
removesuffix(self, suffix, /) Return a bytearray with the given suffix string removed if present. If the bytearray ends with the suffix string and that suffix is not empty, return bytearray[:-len(suffix)]. Otherwise, return a copy of the original bytearray.
replace(self, old, new, count=-1, /) Return a copy with all occurrences of substring old replaced by new. count Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences. If the optional argument count is given, only the first count occurrences are replaced.
reverse(self, /) Reverse the order of the values in B in place.
rfind(...) B.rfind(sub[, start[, end]]) -> int Return the highest index in B where subsection sub is found, such that sub is contained within B[start,end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure.
rindex(...) B.rindex(sub[, start[, end]]) -> int Return the highest index in B where subsection sub is found, such that sub is contained within B[start,end]. Optional arguments start and end are interpreted as in slice notation. Raise ValueError when the subsection is not found.
rjust(self, width, fillchar=b' ', /) Return a right-justified string of length width. Padding is done using the specified fill character.
rpartition(self, sep, /) Partition the bytearray into three parts using the given separator. This will search for the separator sep in the bytearray, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it as new bytearray objects. If the separator is not found, returns a 3-tuple containing two empty bytearray objects and the copy of the original bytearray object.
rsplit(self, /, sep=None, maxsplit=-1) Return a list of the sections in the bytearray, using sep as the delimiter. sep The delimiter according which to split the bytearray. None (the default value) means split on ASCII whitespace characters (space, tab, return, newline, formfeed, vertical tab). maxsplit Maximum number of splits to do. -1 (the default value) means no limit. Splitting is done starting at the end of the bytearray and working to the front.
rstrip(self, bytes=None, /) Strip trailing bytes contained in the argument. If the argument is omitted or None, strip trailing ASCII whitespace.
split(self, /, sep=None, maxsplit=-1) Return a list of the sections in the bytearray, using sep as the delimiter. sep The delimiter according which to split the bytearray. None (the default value) means split on ASCII whitespace characters (space, tab, return, newline, formfeed, vertical tab). maxsplit Maximum number of splits to do. -1 (the default value) means no limit.
splitlines(self, /, keepends=False) Return a list of the lines in the bytearray, breaking at line boundaries. Line breaks are not included in the resulting list unless keepends is given and true.
startswith(...) B.startswith(prefix[, start[, end]]) -> bool Return True if B starts with the specified prefix, False otherwise. With optional start, test B beginning at that position. With optional end, stop comparing B at that position. prefix can also be a tuple of bytes to try.
strip(self, bytes=None, /) Strip leading and trailing bytes contained in the argument. If the argument is omitted or None, strip leading and trailing ASCII whitespace.
swapcase(...) B.swapcase() -> copy of B Return a copy of B with uppercase ASCII characters converted to lowercase ASCII and vice versa.
title(...) B.title() -> copy of B Return a titlecased version of B, i.e. ASCII words start with uppercase characters, all remaining cased characters have lowercase.
translate(self, table, /, delete=b'') Return a copy with each character mapped by the given translation table. table Translation table, which must be a bytes object of length 256. All characters occurring in the optional argument delete are removed. The remaining characters are mapped through the given translation table.
upper(...) B.upper() -> copy of B Return a copy of B with all ASCII characters converted to uppercase.
zfill(self, width, /) Pad a numeric string with zeros on the left, to fill a field of the given width. The original string is never truncated.
bytes(iterable_of_ints) -> bytes bytes(string, encoding[, errors]) -> bytes bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer bytes(int) -> bytes object of size given by the parameter initialized with null bytes bytes() -> empty bytes object Construct an immutable array of bytes from: - an iterable yielding integers in range(256) - a text string encoded using the specified encoding - any object implementing the buffer API. - an integer
capitalize(...) B.capitalize() -> copy of B Return a copy of B with only its first character capitalized (ASCII) and the rest lower-cased.
center(self, width, fillchar=b' ', /) Return a centered string of length width. Padding is done using the specified fill character.
count(...) B.count(sub[, start[, end]]) -> int Return the number of non-overlapping occurrences of subsection sub in bytes B[start:end]. Optional arguments start and end are interpreted as in slice notation.
decode(self, /, encoding='utf-8', errors='strict') Decode the bytes using the codec registered for encoding. encoding The encoding with which to decode the bytes. errors The error handling scheme to use for the handling of decoding errors. The default is 'strict' meaning that decoding errors raise a UnicodeDecodeError. Other possible values are 'ignore' and 'replace' as well as any other name registered with codecs.register_error that can handle UnicodeDecodeErrors.
endswith(...) B.endswith(suffix[, start[, end]]) -> bool Return True if B ends with the specified suffix, False otherwise. With optional start, test B beginning at that position. With optional end, stop comparing B at that position. suffix can also be a tuple of bytes to try.
expandtabs(self, /, tabsize=8) Return a copy where all tab characters are expanded using spaces. If tabsize is not given, a tab size of 8 characters is assumed.
find(...) B.find(sub[, start[, end]]) -> int Return the lowest index in B where subsection sub is found, such that sub is contained within B[start,end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure.
fromhex(string, /) Create a bytes object from a string of hexadecimal numbers. Spaces between two numbers are accepted. Example: bytes.fromhex('B9 01EF') -> b'\\xb9\\x01\\xef'.
hex(...) Create a string of hexadecimal numbers from a bytes object. sep An optional single character or byte to separate hex bytes. bytes_per_sep How many bytes between separators. Positive values count from the right, negative values count from the left. Example: >>> value = b'\xb9\x01\xef' >>> value.hex() 'b901ef' >>> value.hex(':') 'b9:01:ef' >>> value.hex(':', 2) 'b9:01ef' >>> value.hex(':', -2) 'b901:ef'
index(...) B.index(sub[, start[, end]]) -> int Return the lowest index in B where subsection sub is found, such that sub is contained within B[start,end]. Optional arguments start and end are interpreted as in slice notation. Raises ValueError when the subsection is not found.
isalnum(...) B.isalnum() -> bool Return True if all characters in B are alphanumeric and there is at least one character in B, False otherwise.
isalpha(...) B.isalpha() -> bool Return True if all characters in B are alphabetic and there is at least one character in B, False otherwise.
isascii(...) B.isascii() -> bool Return True if B is empty or all characters in B are ASCII, False otherwise.
isdigit(...) B.isdigit() -> bool Return True if all characters in B are digits and there is at least one character in B, False otherwise.
islower(...) B.islower() -> bool Return True if all cased characters in B are lowercase and there is at least one cased character in B, False otherwise.
isspace(...) B.isspace() -> bool Return True if all characters in B are whitespace and there is at least one character in B, False otherwise.
istitle(...) B.istitle() -> bool Return True if B is a titlecased string and there is at least one character in B, i.e. uppercase characters may only follow uncased characters and lowercase characters only cased ones. Return False otherwise.
isupper(...) B.isupper() -> bool Return True if all cased characters in B are uppercase and there is at least one cased character in B, False otherwise.
join(self, iterable_of_bytes, /) Concatenate any number of bytes objects. The bytes whose method is called is inserted in between each pair. The result is returned as a new bytes object. Example: b'.'.join([b'ab', b'pq', b'rs']) -> b'ab.pq.rs'.
ljust(self, width, fillchar=b' ', /) Return a left-justified string of length width. Padding is done using the specified fill character.
lower(...) B.lower() -> copy of B Return a copy of B with all ASCII characters converted to lowercase.
lstrip(self, bytes=None, /) Strip leading bytes contained in the argument. If the argument is omitted or None, strip leading ASCII whitespace.
maketrans(frm, to, /) Return a translation table useable for the bytes or bytearray translate method. The returned table will be one where each byte in frm is mapped to the byte at the same position in to. The bytes objects frm and to must be of the same length.
partition(self, sep, /) Partition the bytes into three parts using the given separator. This will search for the separator sep in the bytes. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it. If the separator is not found, returns a 3-tuple containing the original bytes object and two empty bytes objects.
removeprefix(self, prefix, /) Return a bytes object with the given prefix string removed if present. If the bytes starts with the prefix string, return bytes[len(prefix):]. Otherwise, return a copy of the original bytes.
removesuffix(self, suffix, /) Return a bytes object with the given suffix string removed if present. If the bytes ends with the suffix string and that suffix is not empty, return bytes[:-len(prefix)]. Otherwise, return a copy of the original bytes.
replace(self, old, new, count=-1, /) Return a copy with all occurrences of substring old replaced by new. count Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences. If the optional argument count is given, only the first count occurrences are replaced.
rfind(...) B.rfind(sub[, start[, end]]) -> int Return the highest index in B where subsection sub is found, such that sub is contained within B[start,end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure.
rindex(...) B.rindex(sub[, start[, end]]) -> int Return the highest index in B where subsection sub is found, such that sub is contained within B[start,end]. Optional arguments start and end are interpreted as in slice notation. Raise ValueError when the subsection is not found.
rjust(self, width, fillchar=b' ', /) Return a right-justified string of length width. Padding is done using the specified fill character.
rpartition(self, sep, /) Partition the bytes into three parts using the given separator. This will search for the separator sep in the bytes, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it. If the separator is not found, returns a 3-tuple containing two empty bytes objects and the original bytes object.
rsplit(self, /, sep=None, maxsplit=-1) Return a list of the sections in the bytes, using sep as the delimiter. sep The delimiter according which to split the bytes. None (the default value) means split on ASCII whitespace characters (space, tab, return, newline, formfeed, vertical tab). maxsplit Maximum number of splits to do. -1 (the default value) means no limit. Splitting is done starting at the end of the bytes and working to the front.
rstrip(self, bytes=None, /) Strip trailing bytes contained in the argument. If the argument is omitted or None, strip trailing ASCII whitespace.
split(self, /, sep=None, maxsplit=-1) Return a list of the sections in the bytes, using sep as the delimiter. sep The delimiter according which to split the bytes. None (the default value) means split on ASCII whitespace characters (space, tab, return, newline, formfeed, vertical tab). maxsplit Maximum number of splits to do. -1 (the default value) means no limit.
splitlines(self, /, keepends=False) Return a list of the lines in the bytes, breaking at line boundaries. Line breaks are not included in the resulting list unless keepends is given and true.
startswith(...) B.startswith(prefix[, start[, end]]) -> bool Return True if B starts with the specified prefix, False otherwise. With optional start, test B beginning at that position. With optional end, stop comparing B at that position. prefix can also be a tuple of bytes to try.
strip(self, bytes=None, /) Strip leading and trailing bytes contained in the argument. If the argument is omitted or None, strip leading and trailing ASCII whitespace.
swapcase(...) B.swapcase() -> copy of B Return a copy of B with uppercase ASCII characters converted to lowercase ASCII and vice versa.
title(...) B.title() -> copy of B Return a titlecased version of B, i.e. ASCII words start with uppercase characters, all remaining cased characters have lowercase.
translate(self, table, /, delete=b'') Return a copy with each character mapped by the given translation table. table Translation table, which must be a bytes object of length 256. All characters occurring in the optional argument delete are removed. The remaining characters are mapped through the given translation table.
upper(...) B.upper() -> copy of B Return a copy of B with all ASCII characters converted to uppercase.
zfill(self, width, /) Pad a numeric string with zeros on the left, to fill a field of the given width. The original string is never truncated.
classmethod(function) -> method Convert a function to be a class method. A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom: class C: @classmethod def f(cls, arg1, arg2, ...): ... It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument. Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.
Create a complex number from a real part and an optional imaginary part. This is equivalent to (real + imag*1j) where imag defaults to 0.
conjugate(self, /) Return the complex conjugate of its argument. (3-4j).conjugate() == 3+4j.
imag = <member 'imag' of 'complex' objects> the imaginary part of a complex number
real = <member 'real' of 'complex' objects> the real part of a complex number
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)
clear(...) D.clear() -> None. Remove all items from D.
copy(...) D.copy() -> a shallow copy of D
fromkeys(iterable, value=None, /) Create a new dictionary with keys from iterable and values set to value.
get(self, key, default=None, /) Return the value for key if key is in the dictionary, else default.
items(...) D.items() -> a set-like object providing a view on D's items
keys(...) D.keys() -> a set-like object providing a view on D's keys
pop(...) D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If the key is not found, return the default if given; otherwise, raise a KeyError.
popitem(self, /) Remove and return a (key, value) pair as a 2-tuple. Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
setdefault(self, key, default=None, /) Insert key with a value of default if key is not in the dictionary. Return the value for key if key is in the dictionary, else default.
update(...) D.update([E, ]**F) -> None. Update D from dict/iterable E and F. If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
values(...) D.values() -> an object providing a view on D's values
Return an enumerate object. iterable an object supporting iteration The enumerate object yields pairs containing a count (from start, which defaults to zero) and a value yielded by the iterable argument. enumerate is useful for obtaining an indexed list: (0, seq[0]), (1, seq[1]), (2, seq[2]), ...
filter(function or None, iterable) --> filter object Return an iterator yielding those items of iterable for which function(item) is true. If function is None, return the items that are true.
Convert a string or number to a floating point number, if possible.
as_integer_ratio(self, /) Return integer ratio. Return a pair of integers, whose ratio is exactly equal to the original float and with a positive denominator. Raise OverflowError on infinities and a ValueError on NaNs. >>> (10.0).as_integer_ratio() (10, 1) >>> (0.0).as_integer_ratio() (0, 1) >>> (-.25).as_integer_ratio() (-1, 4)
conjugate(self, /) Return self, the complex conjugate of any float.
fromhex(string, /) Create a floating-point number from a hexadecimal string. >>> float.fromhex('0x1.ffffp10') 2047.984375 >>> float.fromhex('-0x1p-1074') -5e-324
hex(self, /) Return a hexadecimal representation of a floating-point number. >>> (-0.1).hex() '-0x1.999999999999ap-4' >>> 3.14159.hex() '0x1.921f9f01b866ep+1'
is_integer(self, /) Return True if the float is an integer.
imag = <attribute 'imag' of 'float' objects> the imaginary part of a complex number
real = <attribute 'real' of 'float' objects> the real part of a complex number
frozenset() -> empty frozenset object frozenset(iterable) -> frozenset object Build an immutable unordered collection of unique elements.
copy(...) Return a shallow copy of a set.
difference(...) Return the difference of two or more sets as a new set. (i.e. all elements that are in this set but not the others.)
intersection(...) Return the intersection of two sets as a new set. (i.e. all elements that are in both sets.)
isdisjoint(...) Return True if two sets have a null intersection.
issubset(...) Report whether another set contains this set.
issuperset(...) Report whether this set contains another set.
symmetric_difference(...) Return the symmetric difference of two sets as a new set. (i.e. all elements that are in exactly one of the sets.)
union(...) Return the union of sets as a new set. (i.e. all elements that are in either set.)
int([x]) -> integer int(x, base=10) -> integer Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating point numbers, this truncates towards zero. If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int('0b100', base=0) 4
as_integer_ratio(self, /) Return integer ratio. Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator. >>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
bit_count(self, /) Number of ones in the binary representation of the absolute value of self. Also known as the population count. >>> bin(13) '0b1101' >>> (13).bit_count() 3
bit_length(self, /) Number of bits necessary to represent self in binary. >>> bin(37) '0b100101' >>> (37).bit_length() 6
conjugate(...) Returns self, the complex conjugate of any int.
from_bytes(bytes, byteorder, *, signed=False) Return the integer represented by the given array of bytes. bytes Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol. byteorder The byte order used to represent the integer. If byteorder is 'big', the most significant byte is at the beginning of the byte array. If byteorder is 'little', the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder' as the byte order value. signed Indicates whether two's complement is used to represent the integer.
to_bytes(self, /, length, byteorder, *, signed=False) Return an array of bytes representing an integer. length Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. byteorder The byte order used to represent the integer. If byteorder is 'big', the most significant byte is at the beginning of the byte array. If byteorder is 'little', the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder' as the byte order value. signed Determines whether two's complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
denominator = <attribute 'denominator' of 'int' objects> the denominator of a rational number in lowest terms
imag = <attribute 'imag' of 'int' objects> the imaginary part of a complex number
numerator = <attribute 'numerator' of 'int' objects> the numerator of a rational number in lowest terms
real = <attribute 'real' of 'int' objects> the real part of a complex number
Built-in mutable sequence. If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.
append(self, object, /) Append object to the end of the list.
clear(self, /) Remove all items from list.
copy(self, /) Return a shallow copy of the list.
count(self, value, /) Return number of occurrences of value.
extend(self, iterable, /) Extend list by appending elements from the iterable.
index(self, value, start=0, stop=9223372036854775807, /) Return first index of value. Raises ValueError if the value is not present.
insert(self, index, object, /) Insert object before index.
pop(self, index=-1, /) Remove and return item at index (default last). Raises IndexError if list is empty or index is out of range.
remove(self, value, /) Remove first occurrence of value. Raises ValueError if the value is not present.
reverse(self, /) Reverse *IN PLACE*.
sort(self, /, *, key=None, reverse=False) Sort the list in ascending order and return None. The sort is in-place (i.e. the list itself is modified) and stable (i.e. the order of two equal elements is maintained). If a key function is given, apply it once to each list item and sort them, ascending or descending, according to their function values. The reverse flag can be set to sort in descending order.
map(func, *iterables) --> map object Make an iterator that computes the function using arguments from each of the iterables. Stops when the shortest iterable is exhausted.
Create a new memoryview object which references the given object.
cast(...) Cast a memoryview to a new format or shape.
hex(...) Return the data in the buffer as a str of hexadecimal numbers. sep An optional single character or byte to separate hex bytes. bytes_per_sep How many bytes between separators. Positive values count from the right, negative values count from the left. Example: >>> value = memoryview(b'\xb9\x01\xef') >>> value.hex() 'b901ef' >>> value.hex(':') 'b9:01:ef' >>> value.hex(':', 2) 'b9:01ef' >>> value.hex(':', -2) 'b901:ef'
release(self, /) Release the underlying buffer exposed by the memoryview object.
tobytes(self, /, order='C') Return the data in the buffer as a byte string. Order can be {'C', 'F', 'A'}. When order is 'C' or 'F', the data of the original array is converted to C or Fortran order. For contiguous views, 'A' returns an exact copy of the physical memory. In particular, in-memory Fortran order is preserved. For non-contiguous views, the data is converted to C first. order=None is the same as order='C'.
tolist(self, /) Return the data in the buffer as a list of elements.
toreadonly(self, /) Return a readonly version of the memoryview.
c_contiguous = <attribute 'c_contiguous' of 'memoryview' objects> A bool indicating whether the memory is C contiguous.
contiguous = <attribute 'contiguous' of 'memoryview' objects> A bool indicating whether the memory is contiguous.
f_contiguous = <attribute 'f_contiguous' of 'memoryview' objects> A bool indicating whether the memory is Fortran contiguous.
format = <attribute 'format' of 'memoryview' objects> A string containing the format (in struct module style) for each element in the view.
itemsize = <attribute 'itemsize' of 'memoryview' objects> The size in bytes of each element of the memoryview.
nbytes = <attribute 'nbytes' of 'memoryview' objects> The amount of space in bytes that the array would use in a contiguous representation.
ndim = <attribute 'ndim' of 'memoryview' objects> An integer indicating how many dimensions of a multi-dimensional array the memory represents.
obj = <attribute 'obj' of 'memoryview' objects> The underlying object of the memoryview.
readonly = <attribute 'readonly' of 'memoryview' objects> A bool indicating whether the memory is read only.
shape = <attribute 'shape' of 'memoryview' objects> A tuple of ndim integers giving the shape of the memory as an N-dimensional array.
strides = <attribute 'strides' of 'memoryview' objects> A tuple of ndim integers giving the size in bytes to access each element for each dimension of the array.
suboffsets = <attribute 'suboffsets' of 'memoryview' objects> A tuple of integers used internally for PIL-style arrays.
The base class of the class hierarchy. When called, it accepts no arguments and returns a new featureless instance that has no instance attributes and cannot be given any.
Property attribute. fget function to be used for getting an attribute value fset function to be used for setting an attribute value fdel function to be used for del'ing an attribute doc docstring Typical use is to define a managed attribute x: class C(object): def getx(self): return self._x def setx(self, value): self._x = value def delx(self): del self._x x = property(getx, setx, delx, "I'm the 'x' property.") Decorators make defining new properties or modifying existing ones easy: class C(object): @property def x(self): "I am the 'x' property." return self._x @x.setter def x(self, value): self._x = value @x.deleter def x(self): del self._x
deleter(...) Descriptor to obtain a copy of the property with a different deleter.
getter(...) Descriptor to obtain a copy of the property with a different getter.
setter(...) Descriptor to obtain a copy of the property with a different setter.
fdel = <member 'fdel' of 'property' objects>
fget = <member 'fget' of 'property' objects>
fset = <member 'fset' of 'property' objects>
range(stop) -> range object range(start, stop[, step]) -> range object Return an object that produces a sequence of integers from start (inclusive) to stop (exclusive) by step. range(i, j) produces i, i+1, i+2, ..., j-1. start defaults to 0, and stop is omitted! range(4) produces 0, 1, 2, 3. These are exactly the valid indices for a list of 4 elements. When step is given, it specifies the increment (or decrement).
count(...) rangeobject.count(value) -> integer -- return number of occurrences of value
index(...) rangeobject.index(value) -> integer -- return index of value. Raise ValueError if the value is not present.
start = <member 'start' of 'range' objects>
step = <member 'step' of 'range' objects>
stop = <member 'stop' of 'range' objects>
Return a reverse iterator over the values of the given sequence.
set() -> new empty set object set(iterable) -> new set object Build an unordered collection of unique elements.
add(...) Add an element to a set. This has no effect if the element is already present.
clear(...) Remove all elements from this set.
copy(...) Return a shallow copy of a set.
difference(...) Return the difference of two or more sets as a new set. (i.e. all elements that are in this set but not the others.)
difference_update(...) Remove all elements of another set from this set.
discard(...) Remove an element from a set if it is a member. If the element is not a member, do nothing.
intersection(...) Return the intersection of two sets as a new set. (i.e. all elements that are in both sets.)
intersection_update(...) Update a set with the intersection of itself and another.
isdisjoint(...) Return True if two sets have a null intersection.
issubset(...) Report whether another set contains this set.
issuperset(...) Report whether this set contains another set.
pop(...) Remove and return an arbitrary set element. Raises KeyError if the set is empty.
remove(...) Remove an element from a set; it must be a member. If the element is not a member, raise a KeyError.
symmetric_difference(...) Return the symmetric difference of two sets as a new set. (i.e. all elements that are in exactly one of the sets.)
symmetric_difference_update(...) Update a set with the symmetric difference of itself and another.
union(...) Return the union of sets as a new set. (i.e. all elements that are in either set.)
update(...) Update a set with the union of itself and others.
slice(stop) slice(start, stop[, step]) Create a slice object. This is used for extended slicing (e.g. a[0:10:2]).
indices(...) S.indices(len) -> (start, stop, stride) Assuming a sequence of length len, calculate the start and stop indices, and the stride length of the extended slice described by S. Out of bounds indices are clipped in a manner consistent with the handling of normal slices.
start = <member 'start' of 'slice' objects>
step = <member 'step' of 'slice' objects>
stop = <member 'stop' of 'slice' objects>
staticmethod(function) -> method Convert a function to be a static method. A static method does not receive an implicit first argument. To declare a static method, use this idiom: class C: @staticmethod def f(arg1, arg2, ...): ... It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). Both the class and the instance are ignored, and neither is passed implicitly as the first argument to the method. Static methods in Python are similar to those found in Java or C++. For a more advanced concept, see the classmethod builtin.
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
capitalize(self, /) Return a capitalized version of the string. More specifically, make the first character have upper case and the rest lower case.
casefold(self, /) Return a version of the string suitable for caseless comparisons.
center(self, width, fillchar=' ', /) Return a centered string of length width. Padding is done using the specified fill character (default is a space).
count(...) S.count(sub[, start[, end]]) -> int Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.
encode(self, /, encoding='utf-8', errors='strict') Encode the string using the codec registered for encoding. encoding The encoding in which to encode the string. errors The error handling scheme to use for encoding errors. The default is 'strict' meaning that encoding errors raise a UnicodeEncodeError. Other possible values are 'ignore', 'replace' and 'xmlcharrefreplace' as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.
endswith(...) S.endswith(suffix[, start[, end]]) -> bool Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.
expandtabs(self, /, tabsize=8) Return a copy where all tab characters are expanded using spaces. If tabsize is not given, a tab size of 8 characters is assumed.
find(...) S.find(sub[, start[, end]]) -> int Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure.
format(...) S.format(*args, **kwargs) -> str Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces ('{' and '}').
format_map(...) S.format_map(mapping) -> str Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces ('{' and '}').
index(...) S.index(sub[, start[, end]]) -> int Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation. Raises ValueError when the substring is not found.
isalnum(self, /) Return True if the string is an alpha-numeric string, False otherwise. A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.
isalpha(self, /) Return True if the string is an alphabetic string, False otherwise. A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.
isascii(self, /) Return True if all characters in the string are ASCII, False otherwise. ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.
isdecimal(self, /) Return True if the string is a decimal string, False otherwise. A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.
isdigit(self, /) Return True if the string is a digit string, False otherwise. A string is a digit string if all characters in the string are digits and there is at least one character in the string.
isidentifier(self, /) Return True if the string is a valid Python identifier, False otherwise. Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as "def" or "class".
islower(self, /) Return True if the string is a lowercase string, False otherwise. A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.
isnumeric(self, /) Return True if the string is a numeric string, False otherwise. A string is numeric if all characters in the string are numeric and there is at least one character in the string.
isprintable(self, /) Return True if the string is printable, False otherwise. A string is printable if all of its characters are considered printable in repr() or if it is empty.
isspace(self, /) Return True if the string is a whitespace string, False otherwise. A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.
istitle(self, /) Return True if the string is a title-cased string, False otherwise. In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.
isupper(self, /) Return True if the string is an uppercase string, False otherwise. A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.
join(self, iterable, /) Concatenate any number of strings. The string whose method is called is inserted in between each given string. The result is returned as a new string. Example: '.'.join(['ab', 'pq', 'rs']) -> 'ab.pq.rs'
ljust(self, width, fillchar=' ', /) Return a left-justified string of length width. Padding is done using the specified fill character (default is a space).
lower(self, /) Return a copy of the string converted to lowercase.
lstrip(self, chars=None, /) Return a copy of the string with leading whitespace removed. If chars is given and not None, remove characters in chars instead.
maketrans(...) Return a translation table usable for str.translate(). If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.
partition(self, sep, /) Partition the string into three parts using the given separator. This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it. If the separator is not found, returns a 3-tuple containing the original string and two empty strings.
removeprefix(self, prefix, /) Return a str with the given prefix string removed if present. If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.
removesuffix(self, suffix, /) Return a str with the given suffix string removed if present. If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.
replace(self, old, new, count=-1, /) Return a copy with all occurrences of substring old replaced by new. count Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences. If the optional argument count is given, only the first count occurrences are replaced.
rfind(...) S.rfind(sub[, start[, end]]) -> int Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure.
rindex(...) S.rindex(sub[, start[, end]]) -> int Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation. Raises ValueError when the substring is not found.
rjust(self, width, fillchar=' ', /) Return a right-justified string of length width. Padding is done using the specified fill character (default is a space).
rpartition(self, sep, /) Partition the string into three parts using the given separator. This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it. If the separator is not found, returns a 3-tuple containing two empty strings and the original string.
rsplit(self, /, sep=None, maxsplit=-1) Return a list of the substrings in the string, using sep as the separator string. sep The separator used to split the string. When set to None (the default value), will split on any whitespace character (including \\n \\r \\t \\f and spaces) and will discard empty strings from the result. maxsplit Maximum number of splits (starting from the left). -1 (the default value) means no limit. Splitting starts at the end of the string and works to the front.
rstrip(self, chars=None, /) Return a copy of the string with trailing whitespace removed. If chars is given and not None, remove characters in chars instead.
split(self, /, sep=None, maxsplit=-1) Return a list of the substrings in the string, using sep as the separator string. sep The separator used to split the string. When set to None (the default value), will split on any whitespace character (including \\n \\r \\t \\f and spaces) and will discard empty strings from the result. maxsplit Maximum number of splits (starting from the left). -1 (the default value) means no limit. Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.
splitlines(self, /, keepends=False) Return a list of the lines in the string, breaking at line boundaries. Line breaks are not included in the resulting list unless keepends is given and true.
startswith(...) S.startswith(prefix[, start[, end]]) -> bool Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.
strip(self, chars=None, /) Return a copy of the string with leading and trailing whitespace removed. If chars is given and not None, remove characters in chars instead.
swapcase(self, /) Convert uppercase characters to lowercase and lowercase characters to uppercase.
title(self, /) Return a version of the string where each word is titlecased. More specifically, words start with uppercased characters and all remaining cased characters have lower case.
translate(self, table, /) Replace each character in the string using the given translation table. table Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None. The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.
upper(self, /) Return a copy of the string converted to uppercase.
zfill(self, width, /) Pad a numeric string with zeros on the left, to fill a field of the given width. The string is never truncated.
super() -> same as super(__class__, <first argument>) super(type) -> unbound super object super(type, obj) -> bound super object; requires isinstance(obj, type) super(type, type2) -> bound super object; requires issubclass(type2, type) Typical use to call a cooperative superclass method: class C(B): def meth(self, arg): super().meth(arg) This works for class methods too: class C(B): @classmethod def cmeth(cls, arg): super().cmeth(arg)
Built-in immutable sequence. If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items. If the argument is a tuple, the return value is the same object.
count(self, value, /) Return number of occurrences of value.
index(self, value, start=0, stop=9223372036854775807, /) Return first index of value. Raises ValueError if the value is not present.
type(object) -> the object's type type(name, bases, dict, **kwds) -> a new type
mro(self, /) Return a type's method resolution order.
zip(*iterables, strict=False) --> Yield tuples until an input is exhausted. >>> list(zip('abcdefg', range(3), range(4))) [('a', 0, 0), ('b', 1, 1), ('c', 2, 2)] The zip object yields n-length tuples, where n is the number of iterables passed as positional arguments to zip(). The i-th element in every tuple comes from the i-th iterable argument to zip(). This continues until the shortest argument is exhausted. If strict is true and one of the arguments is exhausted before the others, raise a ValueError.
abs(x, /) Return the absolute value of the argument.
aiter(async_iterable, /) Return an AsyncIterator for an AsyncIterable object.
all(iterable, /) Return True if bool(x) is True for all values x in the iterable. If the iterable is empty, return True.
anext(...) Return the next item from the async iterator.
any(iterable, /) Return True if bool(x) is True for any x in the iterable. If the iterable is empty, return False.
ascii(obj, /) Return an ASCII-only representation of an object. As repr(), return a string containing a printable representation of an object, but escape the non-ASCII characters in the string returned by repr() using \\x, \\u or \\U escapes. This generates a string similar to that returned by repr() in Python 2.
bin(number, /) Return the binary representation of an integer. >>> bin(2796202) '0b1010101010101010101010'
breakpoint(...) breakpoint(*args, **kws) Call sys.breakpointhook(*args, **kws). sys.breakpointhook() must accept whatever arguments are passed. By default, this drops you into the pdb debugger.
callable(obj, /) Return whether the object is callable (i.e., some kind of function). Note that classes are callable, as are instances of classes with a __call__() method.
chr(i, /) Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff.
compile(source, filename, mode, flags=0, dont_inherit=False, optimize=-1, *, _feature_version=-1) Compile source into a code object that can be executed by exec() or eval(). The source code may represent a Python module, statement or expression. The filename will be used for run-time error messages. The mode must be 'exec' to compile a module, 'single' to compile a single (interactive) statement, or 'eval' to compile an expression. The flags argument, if present, controls which future statements influence the compilation of the code. The dont_inherit argument, if true, stops the compilation inheriting the effects of any future statements in effect in the code calling compile; if absent or false these statements do influence the compilation, in addition to any features explicitly specified.
delattr(obj, name, /) Deletes the named attribute from the given object. delattr(x, 'y') is equivalent to ``del x.y''
dir(...) dir([object]) -> list of strings If called without an argument, return the names in the current scope. Else, return an alphabetized list of names comprising (some of) the attributes of the given object, and of attributes reachable from it. If the object supplies a method named __dir__, it will be used; otherwise the default dir() logic is used and returns: for a module object: the module's attributes. for a class object: its attributes, and recursively the attributes of its bases. for any other object: its attributes, its class's attributes, and recursively the attributes of its class's base classes.
divmod(x, y, /) Return the tuple (x//y, x%y). Invariant: div*y + mod == x.
eval(source, globals=None, locals=None, /) Evaluate the given source in the context of globals and locals. The source may be a string representing a Python expression or a code object as returned by compile(). The globals must be a dictionary and locals can be any mapping, defaulting to the current globals and locals. If only globals is given, locals defaults to it.
exec(source, globals=None, locals=None, /) Execute the given source in the context of globals and locals. The source may be a string representing one or more Python statements or a code object as returned by compile(). The globals must be a dictionary and locals can be any mapping, defaulting to the current globals and locals. If only globals is given, locals defaults to it.
format(value, format_spec='', /) Return value.__format__(format_spec) format_spec defaults to the empty string. See the Format Specification Mini-Language section of help('FORMATTING') for details.
getattr(...) getattr(object, name[, default]) -> value Get a named attribute from an object; getattr(x, 'y') is equivalent to x.y. When a default argument is given, it is returned when the attribute doesn't exist; without it, an exception is raised in that case.
globals() Return the dictionary containing the current scope's global variables. NOTE: Updates to this dictionary *will* affect name lookups in the current global scope and vice-versa.
hasattr(obj, name, /) Return whether the object has an attribute with the given name. This is done by calling getattr(obj, name) and catching AttributeError.
hash(obj, /) Return the hash value for the given object. Two objects that compare equal must also have the same hash value, but the reverse is not necessarily true.
hex(number, /) Return the hexadecimal representation of an integer. >>> hex(12648430) '0xc0ffee'
id(obj, /) Return the identity of an object. This is guaranteed to be unique among simultaneously existing objects. (CPython uses the object's memory address.)
input(prompt=None, /) Read a string from standard input. The trailing newline is stripped. The prompt string, if given, is printed to standard output without a trailing newline before reading input. If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError. On *nix systems, readline is used if available.
isinstance(obj, class_or_tuple, /) Return whether an object is an instance of a class or of a subclass thereof. A tuple, as in ``isinstance(x, (A, B, ...))``, may be given as the target to check against. This is equivalent to ``isinstance(x, A) or isinstance(x, B) or ...`` etc.
issubclass(cls, class_or_tuple, /) Return whether 'cls' is derived from another class or is the same class. A tuple, as in ``issubclass(x, (A, B, ...))``, may be given as the target to check against. This is equivalent to ``issubclass(x, A) or issubclass(x, B) or ...``.
iter(...) iter(iterable) -> iterator iter(callable, sentinel) -> iterator Get an iterator from an object. In the first form, the argument must supply its own iterator, or be a sequence. In the second form, the callable is called until it returns the sentinel.
len(obj, /) Return the number of items in a container.
locals() Return a dictionary containing the current scope's local variables. NOTE: Whether or not updates to this dictionary will affect name lookups in the local scope and vice-versa is *implementation dependent* and not covered by any backwards compatibility guarantees.
max(...) max(iterable, *[, default=obj, key=func]) -> value max(arg1, arg2, *args, *[, key=func]) -> value With a single iterable argument, return its biggest item. The default keyword-only argument specifies an object to return if the provided iterable is empty. With two or more arguments, return the largest argument.
min(...) min(iterable, *[, default=obj, key=func]) -> value min(arg1, arg2, *args, *[, key=func]) -> value With a single iterable argument, return its smallest item. The default keyword-only argument specifies an object to return if the provided iterable is empty. With two or more arguments, return the smallest argument.
next(...) next(iterator[, default]) Return the next item from the iterator. If default is given and the iterator is exhausted, it is returned instead of raising StopIteration.
oct(number, /) Return the octal representation of an integer. >>> oct(342391) '0o1234567'
open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) Open file and return a stream. Raise OSError upon failure. file is either a text or byte string giving the name (and the path if the file isn't in the current working directory) of the file to be opened or an integer file descriptor of the file to be wrapped. (If a file descriptor is given, it is closed when the returned I/O object is closed, unless closefd is set to False.) mode is an optional string that specifies the mode in which the file is opened. It defaults to 'r' which means open for reading in text mode. Other common values are 'w' for writing (truncating the file if it already exists), 'x' for creating and writing to a new file, and 'a' for appending (which on some Unix systems, means that all writes append to the end of the file regardless of the current seek position). In text mode, if encoding is not specified the encoding used is platform dependent: locale.getpreferredencoding(False) is called to get the current locale encoding. (For reading and writing raw bytes use binary mode and leave encoding unspecified.) The available modes are: ========= =============================================================== Character Meaning --------- --------------------------------------------------------------- 'r' open for reading (default) 'w' open for writing, truncating the file first 'x' create a new file and open it for writing 'a' open for writing, appending to the end of the file if it exists 'b' binary mode 't' text mode (default) '+' open a disk file for updating (reading and writing) 'U' universal newline mode (deprecated) ========= =============================================================== The default mode is 'rt' (open for reading text). For binary random access, the mode 'w+b' opens and truncates the file to 0 bytes, while 'r+b' opens the file without truncation. The 'x' mode implies 'w' and raises an `FileExistsError` if the file already exists. Python distinguishes between files opened in binary and text modes, even when the underlying operating system doesn't. Files opened in binary mode (appending 'b' to the mode argument) return contents as bytes objects without any decoding. In text mode (the default, or when 't' is appended to the mode argument), the contents of the file are returned as strings, the bytes having been first decoded using a platform-dependent encoding or using the specified encoding if given. 'U' mode is deprecated and will raise an exception in future versions of Python. It has no effect in Python 3. Use newline to control universal newlines mode. buffering is an optional integer used to set the buffering policy. Pass 0 to switch buffering off (only allowed in binary mode), 1 to select line buffering (only usable in text mode), and an integer > 1 to indicate the size of a fixed-size chunk buffer. When no buffering argument is given, the default buffering policy works as follows: * Binary files are buffered in fixed-size chunks; the size of the buffer is chosen using a heuristic trying to determine the underlying device's "block size" and falling back on `io.DEFAULT_BUFFER_SIZE`. On many systems, the buffer will typically be 4096 or 8192 bytes long. * "Interactive" text files (files for which isatty() returns True) use line buffering. Other text files use the policy described above for binary files. encoding is the name of the encoding used to decode or encode the file. This should only be used in text mode. The default encoding is platform dependent, but any encoding supported by Python can be passed. See the codecs module for the list of supported encodings. errors is an optional string that specifies how encoding errors are to be handled---this argument should not be used in binary mode. Pass 'strict' to raise a ValueError exception if there is an encoding error (the default of None has the same effect), or pass 'ignore' to ignore errors. (Note that ignoring encoding errors can lead to data loss.) See the documentation for codecs.register or run 'help(codecs.Codec)' for a list of the permitted encoding error strings. newline controls how universal newlines works (it only applies to text mode). It can be None, '', '\n', '\r', and '\r\n'. It works as follows: * On input, if newline is None, universal newlines mode is enabled. Lines in the input can end in '\n', '\r', or '\r\n', and these are translated into '\n' before being returned to the caller. If it is '', universal newline mode is enabled, but line endings are returned to the caller untranslated. If it has any of the other legal values, input lines are only terminated by the given string, and the line ending is returned to the caller untranslated. * On output, if newline is None, any '\n' characters written are translated to the system default line separator, os.linesep. If newline is '' or '\n', no translation takes place. If newline is any of the other legal values, any '\n' characters written are translated to the given string. If closefd is False, the underlying file descriptor will be kept open when the file is closed. This does not work when a file name is given and must be True in that case. A custom opener can be used by passing a callable as *opener*. The underlying file descriptor for the file object is then obtained by calling *opener* with (*file*, *flags*). *opener* must return an open file descriptor (passing os.open as *opener* results in functionality similar to passing None). open() returns a file object whose type depends on the mode, and through which the standard file operations such as reading and writing are performed. When open() is used to open a file in a text mode ('w', 'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open a file in a binary mode, the returned class varies: in read binary mode, it returns a BufferedReader; in write binary and append binary modes, it returns a BufferedWriter, and in read/write mode, it returns a BufferedRandom. It is also possible to use a string or bytearray as a file for both reading and writing. For strings StringIO can be used like a file opened in a text mode, and for bytes a BytesIO can be used like a file opened in a binary mode.
ord(c, /) Return the Unicode code point for a one-character string.
pow(base, exp, mod=None) Equivalent to base**exp with 2 arguments or base**exp % mod with 3 arguments Some types, such as ints, are able to use a more efficient algorithm when invoked using the three argument form.
print(...) print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False) Prints the values to a stream, or to sys.stdout by default. Optional keyword arguments: file: a file-like object (stream); defaults to the current sys.stdout. sep: string inserted between values, default a space. end: string appended after the last value, default a newline. flush: whether to forcibly flush the stream.
repr(obj, /) Return the canonical string representation of the object. For many object types, including most builtins, eval(repr(obj)) == obj.
round(number, ndigits=None) Round a number to a given precision in decimal digits. The return value is an integer if ndigits is omitted or None. Otherwise the return value has the same type as the number. ndigits may be negative.
setattr(obj, name, value, /) Sets the named attribute on the given object to the specified value. setattr(x, 'y', v) is equivalent to ``x.y = v''
sorted(iterable, /, *, key=None, reverse=False) Return a new list containing all items from the iterable in ascending order. A custom key function can be supplied to customize the sort order, and the reverse flag can be set to request the result in descending order.
sum(iterable, /, start=0) Return the sum of a 'start' value (default: 0) plus an iterable of numbers When the iterable is empty, return the start value. This function is intended specifically for use with numeric values and may reject non-numeric types.
vars(...) vars([object]) -> dictionary Without arguments, equivalent to locals(). With an argument, equivalent to object.__dict__.
Ellipsis = Ellipsis
False = False
None = None
NotImplemented = NotImplemented
True = True
copyright = Copyright (c) 2001-2022 Python Software Foundation. All Rights Reserved. Copyright (c) 2000 BeOpen.com. All Rights Reserved. Copyright (c) 1995-2001 Corporation for National Research Initiatives. All Rights Reserved. Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam. All Rights Reserved.
credits = Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands for supporting Python development. See www.python.org for more information.
exit = Use exit() or Ctrl-D (i.e. EOF) to exit
help = Type help() for interactive help, or help(object) for help about object.
license = Type license() to see the full license text
quit = Use quit() or Ctrl-D (i.e. EOF) to exit