Python/Справочник по библиотеке Python 3.1: различия между версиями

Содержимое удалено Содержимое добавлено
Нет описания правки
Нет описания правки
Строка 76:
 
Конвертирует значение в булево, используя стандартный процедуру тестирования истинности. Если значение х ложно или отсутствует, то возвращает '''False'''(ложь); в другом случае '''True'''(истина) '''bool''' также является классом, который является подклассом '''int'''. У класса '''bool''' не может быть подкласса. Он может принимать значение только '''False'''(ложь) или '''True'''(истина)
 
'''bytearray([source[, encoding[, errors]]])'''
<-
Return a new array of bytes. The bytearray type is a mutable sequence of integers in the range 0 <= x < 256. It has most of the usual methods of mutable sequences, described in Mutable Sequence Types, as well as most methods that the str type has, see Bytes and Byte Array Methods.
 
The optional source parameter can be used to initialize the array in a few different ways:
 
* If it is a string, you must also give the encoding (and optionally, errors) parameters; bytearray() then converts the string to bytes using str.encode().
* If it is an integer, the array will have that size and will be initialized with null bytes.
* If it is an object conforming to the buffer interface, a read-only buffer of the object will be used to initialize the bytes array.
* If it is an iterable, it must be an iterable of integers in the range 0 <= x < 256, which are used as the initial contents of the array.
 
Without an argument, an array of size 0 is created.
->