mimetypes.add_type()

mimetypes.add_type(type, ext, strict=True) Add a mapping from the MIME type type to the extension ext. When the extension is already known, the new type will replace the old one. When the type is already known the extension will be added to the list of known extensions. When strict is True (the default), the mapping will be added to the official MIME types, otherwise to the non-standard ones.

memoryview.__eq__()

__eq__(exporter) A memoryview and a PEP 3118 exporter are equal if their shapes are equivalent and if all corresponding values are equal when the operands’ respective format codes are interpreted using struct syntax. For the subset of struct format strings currently supported by tolist(), v and w are equal if v.tolist() == w.tolist(): >>> import array >>> a = array.array('I', [1, 2, 3, 4, 5]) >>> b = array.array('d', [1.0, 2.0, 3.0, 4.0, 5.0]) >>> c = arra

memoryview.tolist()

tolist() Return the data in the buffer as a list of elements. >>> memoryview(b'abc').tolist() [97, 98, 99] >>> import array >>> a = array.array('d', [1.1, 2.2, 3.3]) >>> m = memoryview(a) >>> m.tolist() [1.1, 2.2, 3.3] Changed in version 3.3: tolist() now supports all single character native formats in struct module syntax as well as multi-dimensional representations.

memoryview.tobytes()

tobytes() Return the data in the buffer as a bytestring. This is equivalent to calling the bytes constructor on the memoryview. >>> m = memoryview(b"abc") >>> m.tobytes() b'abc' >>> bytes(m) b'abc' For non-contiguous arrays the result is equal to the flattened list representation with all elements converted to bytes. tobytes() supports all format strings, including those that are not in struct module syntax.

memoryview.suboffsets

suboffsets Used internally for PIL-style arrays. The value is informational only.

memoryview.strides

strides A tuple of integers the length of ndim giving the size in bytes to access each element for each dimension of the array. Changed in version 3.3: An empty tuple instead of None when ndim = 0.

memoryview.shape

shape A tuple of integers the length of ndim giving the shape of the memory as an N-dimensional array. Changed in version 3.3: An empty tuple instead of None when ndim = 0.

memoryview.release()

release() Release the underlying buffer exposed by the memoryview object. Many objects take special actions when a view is held on them (for example, a bytearray would temporarily forbid resizing); therefore, calling release() is handy to remove these restrictions (and free any dangling resources) as soon as possible. After this method has been called, any further operation on the view raises a ValueError (except release() itself which can be called multiple times): >>> m = memoryvi

memoryview.readonly

readonly A bool indicating whether the memory is read only.

memoryview.obj

obj The underlying object of the memoryview: >>> b = bytearray(b'xyz') >>> m = memoryview(b) >>> m.obj is b True New in version 3.3.