{
    "content": [
        {
            "type": "text",
            "text": "# array (pydoc)\n\n**Summary:** array\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **DESCRIPTION** (5 lines)\n- **CLASSES** (224 lines) — 1 subsections\n  - class array (220 lines)\n- **DATA** (2 lines)\n- **FILE** (3 lines)\n\n## Full Content\n\n### NAME\n\narray\n\n### DESCRIPTION\n\nThis module defines an object type which can efficiently represent\nan array of basic values: characters, integers, floating point\nnumbers.  Arrays are sequence types and behave very much like lists,\nexcept that the type of objects stored in them is constrained.\n\n### CLASSES\n\nbuiltins.object\narray\n\nArrayType = class array(builtins.object)\n|  array(typecode [, initializer]) -> array\n|\n|  Return a new array whose items are restricted by typecode, and\n|  initialized from the optional initializer value, which must be a list,\n|  string or iterable over elements of the appropriate type.\n|\n|  Arrays represent basic values and behave very much like lists, except\n|  the type of objects stored in them is constrained. The type is specified\n|  at object creation time by using a type code, which is a single character.\n|  The following type codes are defined:\n|\n|      Type code   C Type             Minimum size in bytes\n|      'b'         signed integer     1\n|      'B'         unsigned integer   1\n|      'u'         Unicode character  2 (see note)\n|      'h'         signed integer     2\n|      'H'         unsigned integer   2\n|      'i'         signed integer     2\n|      'I'         unsigned integer   2\n|      'l'         signed integer     4\n|      'L'         unsigned integer   4\n|      'q'         signed integer     8 (see note)\n|      'Q'         unsigned integer   8 (see note)\n|      'f'         floating point     4\n|      'd'         floating point     8\n|\n|  NOTE: The 'u' typecode corresponds to Python's unicode character. On\n|  narrow builds this is 2-bytes on wide builds this is 4-bytes.\n|\n|  NOTE: The 'q' and 'Q' type codes are only available if the platform\n|  C compiler used to build Python supports 'long long', or, on Windows,\n|  'int64'.\n|\n|  Methods:\n|\n|  append() -- append a new item to the end of the array\n|  bufferinfo() -- return information giving the current memory info\n|  byteswap() -- byteswap all the items of the array\n|  count() -- return number of occurrences of an object\n|  extend() -- extend array by appending multiple elements from an iterable\n|  fromfile() -- read items from a file object\n|  fromlist() -- append items from the list\n|  frombytes() -- append items from the string\n|  index() -- return index of first occurrence of an object\n|  insert() -- insert a new item into the array at a provided position\n|  pop() -- remove and return item (default last)\n|  remove() -- remove first occurrence of an object\n|  reverse() -- reverse the order of the items in the array\n|  tofile() -- write all items to a file object\n|  tolist() -- return the array converted to an ordinary list\n|  tobytes() -- return the array converted to a string\n|\n|  Attributes:\n|\n|  typecode -- the typecode character used to create the array\n|  itemsize -- the length in bytes of one array item\n|\n|  Methods defined here:\n|\n|  add(self, value, /)\n|      Return self+value.\n|\n|  contains(self, key, /)\n|      Return key in self.\n|\n|  copy(self, /)\n|      Return a copy of the array.\n|\n|  deepcopy(self, unused, /)\n|      Return a copy of the array.\n|\n|  delitem(self, key, /)\n|      Delete self[key].\n|\n|  eq(self, value, /)\n|      Return self==value.\n|\n|  ge(self, value, /)\n|      Return self>=value.\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  getitem(self, key, /)\n|      Return self[key].\n|\n|  gt(self, value, /)\n|      Return self>value.\n|\n|  iadd(self, value, /)\n|      Implement self+=value.\n|\n|  imul(self, value, /)\n|      Implement self*=value.\n|\n|  iter(self, /)\n|      Implement iter(self).\n|\n|  le(self, value, /)\n|      Return self<=value.\n|\n|  len(self, /)\n|      Return len(self).\n|\n|  lt(self, value, /)\n|      Return self<value.\n|\n|  mul(self, value, /)\n|      Return self*value.\n|\n|  ne(self, value, /)\n|      Return self!=value.\n|\n|  reduceex(self, value, /)\n|      Return state information for pickling.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  rmul(self, value, /)\n|      Return value*self.\n|\n|  setitem(self, key, value, /)\n|      Set self[key] to value.\n|\n|  sizeof(self, /)\n|      Size of the array in memory, in bytes.\n|\n|  append(self, v, /)\n|      Append new value v to the end of the array.\n|\n|  bufferinfo(self, /)\n|      Return a tuple (address, length) giving the current memory address and the length in items of the buffer used to hold array's contents.\n|\n|      The length should be multiplied by the itemsize attribute to calculate\n|      the buffer length in bytes.\n|\n|  byteswap(self, /)\n|      Byteswap all items of the array.\n|\n|      If the items in the array are not 1, 2, 4, or 8 bytes in size, RuntimeError is\n|      raised.\n|\n|  count(self, v, /)\n|      Return number of occurrences of v in the array.\n|\n|  extend(self, bb, /)\n|      Append items to the end of the array.\n|\n|  frombytes(self, buffer, /)\n|      Appends items from the string, interpreting it as an array of machine values, as if it had been read from a file using the fromfile() method.\n|\n|  fromfile(self, f, n, /)\n|      Read n objects from the file object f and append them to the end of the array.\n|\n|  fromlist(self, list, /)\n|      Append items to array from list.\n|\n|  fromunicode(self, ustr, /)\n|      Extends this array with data from the unicode string ustr.\n|\n|      The array must be a unicode type array; otherwise a ValueError is raised.\n|      Use array.frombytes(ustr.encode(...)) to append Unicode data to an array of\n|      some other type.\n|\n|  index(self, v, start=0, stop=9223372036854775807, /)\n|      Return index of first occurrence of v in the array.\n|\n|      Raise ValueError if the value is not present.\n|\n|  insert(self, i, v, /)\n|      Insert a new item v into the array before position i.\n|\n|  pop(self, i=-1, /)\n|      Return the i-th element and delete it from the array.\n|\n|      i defaults to -1.\n|\n|  remove(self, v, /)\n|      Remove the first occurrence of v in the array.\n|\n|  reverse(self, /)\n|      Reverse the order of the items in the array.\n|\n|  tobytes(self, /)\n|      Convert the array to an array of machine values and return the bytes representation.\n|\n|  tofile(self, f, /)\n|      Write all items (as machine values) to the file object f.\n|\n|  tolist(self, /)\n|      Convert array to an ordinary list with the same items.\n|\n|  tounicode(self, /)\n|      Extends this array with data from the unicode string ustr.\n|\n|      Convert the array to a unicode string.  The array must be a unicode type array;\n|      otherwise a ValueError is raised.  Use array.tobytes().decode() to obtain a\n|      unicode string from an array of some other type.\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  itemsize\n|      the size, in bytes, of one array item\n|\n|  typecode\n|      the typecode character used to create the array\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  hash = None\n\n#### class array\n\n|  array(typecode [, initializer]) -> array\n|\n|  Return a new array whose items are restricted by typecode, and\n|  initialized from the optional initializer value, which must be a list,\n|  string or iterable over elements of the appropriate type.\n|\n|  Arrays represent basic values and behave very much like lists, except\n|  the type of objects stored in them is constrained. The type is specified\n|  at object creation time by using a type code, which is a single character.\n|  The following type codes are defined:\n|\n|      Type code   C Type             Minimum size in bytes\n|      'b'         signed integer     1\n|      'B'         unsigned integer   1\n|      'u'         Unicode character  2 (see note)\n|      'h'         signed integer     2\n|      'H'         unsigned integer   2\n|      'i'         signed integer     2\n|      'I'         unsigned integer   2\n|      'l'         signed integer     4\n|      'L'         unsigned integer   4\n|      'q'         signed integer     8 (see note)\n|      'Q'         unsigned integer   8 (see note)\n|      'f'         floating point     4\n|      'd'         floating point     8\n|\n|  NOTE: The 'u' typecode corresponds to Python's unicode character. On\n|  narrow builds this is 2-bytes on wide builds this is 4-bytes.\n|\n|  NOTE: The 'q' and 'Q' type codes are only available if the platform\n|  C compiler used to build Python supports 'long long', or, on Windows,\n|  'int64'.\n|\n|  Methods:\n|\n|  append() -- append a new item to the end of the array\n|  bufferinfo() -- return information giving the current memory info\n|  byteswap() -- byteswap all the items of the array\n|  count() -- return number of occurrences of an object\n|  extend() -- extend array by appending multiple elements from an iterable\n|  fromfile() -- read items from a file object\n|  fromlist() -- append items from the list\n|  frombytes() -- append items from the string\n|  index() -- return index of first occurrence of an object\n|  insert() -- insert a new item into the array at a provided position\n|  pop() -- remove and return item (default last)\n|  remove() -- remove first occurrence of an object\n|  reverse() -- reverse the order of the items in the array\n|  tofile() -- write all items to a file object\n|  tolist() -- return the array converted to an ordinary list\n|  tobytes() -- return the array converted to a string\n|\n|  Attributes:\n|\n|  typecode -- the typecode character used to create the array\n|  itemsize -- the length in bytes of one array item\n|\n|  Methods defined here:\n|\n|  add(self, value, /)\n|      Return self+value.\n|\n|  contains(self, key, /)\n|      Return key in self.\n|\n|  copy(self, /)\n|      Return a copy of the array.\n|\n|  deepcopy(self, unused, /)\n|      Return a copy of the array.\n|\n|  delitem(self, key, /)\n|      Delete self[key].\n|\n|  eq(self, value, /)\n|      Return self==value.\n|\n|  ge(self, value, /)\n|      Return self>=value.\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  getitem(self, key, /)\n|      Return self[key].\n|\n|  gt(self, value, /)\n|      Return self>value.\n|\n|  iadd(self, value, /)\n|      Implement self+=value.\n|\n|  imul(self, value, /)\n|      Implement self*=value.\n|\n|  iter(self, /)\n|      Implement iter(self).\n|\n|  le(self, value, /)\n|      Return self<=value.\n|\n|  len(self, /)\n|      Return len(self).\n|\n|  lt(self, value, /)\n|      Return self<value.\n|\n|  mul(self, value, /)\n|      Return self*value.\n|\n|  ne(self, value, /)\n|      Return self!=value.\n|\n|  reduceex(self, value, /)\n|      Return state information for pickling.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  rmul(self, value, /)\n|      Return value*self.\n|\n|  setitem(self, key, value, /)\n|      Set self[key] to value.\n|\n|  sizeof(self, /)\n|      Size of the array in memory, in bytes.\n|\n|  append(self, v, /)\n|      Append new value v to the end of the array.\n|\n|  bufferinfo(self, /)\n|      Return a tuple (address, length) giving the current memory address and the length in items of the buffer used to hold array's contents.\n|\n|      The length should be multiplied by the itemsize attribute to calculate\n|      the buffer length in bytes.\n|\n|  byteswap(self, /)\n|      Byteswap all items of the array.\n|\n|      If the items in the array are not 1, 2, 4, or 8 bytes in size, RuntimeError is\n|      raised.\n|\n|  count(self, v, /)\n|      Return number of occurrences of v in the array.\n|\n|  extend(self, bb, /)\n|      Append items to the end of the array.\n|\n|  frombytes(self, buffer, /)\n|      Appends items from the string, interpreting it as an array of machine values, as if it had been read from a file using the fromfile() method.\n|\n|  fromfile(self, f, n, /)\n|      Read n objects from the file object f and append them to the end of the array.\n|\n|  fromlist(self, list, /)\n|      Append items to array from list.\n|\n|  fromunicode(self, ustr, /)\n|      Extends this array with data from the unicode string ustr.\n|\n|      The array must be a unicode type array; otherwise a ValueError is raised.\n|      Use array.frombytes(ustr.encode(...)) to append Unicode data to an array of\n|      some other type.\n|\n|  index(self, v, start=0, stop=9223372036854775807, /)\n|      Return index of first occurrence of v in the array.\n|\n|      Raise ValueError if the value is not present.\n|\n|  insert(self, i, v, /)\n|      Insert a new item v into the array before position i.\n|\n|  pop(self, i=-1, /)\n|      Return the i-th element and delete it from the array.\n|\n|      i defaults to -1.\n|\n|  remove(self, v, /)\n|      Remove the first occurrence of v in the array.\n|\n|  reverse(self, /)\n|      Reverse the order of the items in the array.\n|\n|  tobytes(self, /)\n|      Convert the array to an array of machine values and return the bytes representation.\n|\n|  tofile(self, f, /)\n|      Write all items (as machine values) to the file object f.\n|\n|  tolist(self, /)\n|      Convert array to an ordinary list with the same items.\n|\n|  tounicode(self, /)\n|      Extends this array with data from the unicode string ustr.\n|\n|      Convert the array to a unicode string.  The array must be a unicode type array;\n|      otherwise a ValueError is raised.  Use array.tobytes().decode() to obtain a\n|      unicode string from an array of some other type.\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  itemsize\n|      the size, in bytes, of one array item\n|\n|  typecode\n|      the typecode character used to create the array\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  hash = None\n\n### DATA\n\ntypecodes = 'bBuhHiIlLqQfd'\n\n### FILE\n\n(built-in)\n\n"
        }
    ],
    "structuredContent": {
        "command": "array",
        "section": "",
        "mode": "pydoc",
        "summary": "array",
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "CLASSES",
                "lines": 224,
                "subsections": [
                    {
                        "name": "class array",
                        "lines": 220
                    }
                ]
            },
            {
                "name": "DATA",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "FILE",
                "lines": 3,
                "subsections": []
            }
        ]
    }
}