{
    "mode": "pydoc",
    "parameter": "six",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/pydoc/six/json",
    "generated": "2026-06-02T14:19:06Z",
    "sections": {
        "NAME": {
            "content": "six - Utilities for writing code that runs on Python 2 and 3\n",
            "subsections": []
        },
        "PACKAGE CONTENTS": {
            "content": "",
            "subsections": []
        },
        "SUBMODULES": {
            "content": "moves\n",
            "subsections": []
        },
        "CLASSES": {
            "content": "builtins.module(builtins.object)\nModulesixmovesurllib\nLazyDescr(builtins.object)\nMovedAttribute\nMovedModule\nLazyModule(builtins.module)\nModulesixmovesurlliberror\nModulesixmovesurllibparse\nModulesixmovesurllibrequest\nModulesixmovesurllibresponse\nModulesixmovesurllibrobotparser\n",
            "subsections": [
                {
                    "name": "class Module_six_moves_urllib",
                    "content": "|  Modulesixmovesurllib(name, doc=None)\n|\n|  Create a six.moves.urllib namespace that resembles the Python 3 namespace\n|\n|  Method resolution order:\n|      Modulesixmovesurllib\n|      builtins.module\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  dir(self)\n|      dir() -> list\n|      specialized dir() implementation\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  annotations = {}\n|\n|  error = <module 'six.moves.urllib.error'>\n|\n|  parse = <module 'six.moves.urllibparse'>\n|\n|  request = <module 'six.moves.urllib.request'>\n|\n|  response = <module 'six.moves.urllib.response'>\n|\n|  robotparser = <module 'six.moves.urllib.robotparser'>\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.module:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.module:\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 inherited from builtins.module:\n|\n|  dict\n"
                },
                {
                    "name": "class Module_six_moves_urllib_error",
                    "content": "|  Modulesixmovesurlliberror(name)\n|\n|  Lazy loading of moved objects in six.moves.urlliberror\n|\n|  Method resolution order:\n|      Modulesixmovesurlliberror\n|      LazyModule\n|      builtins.module\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  ContentTooShortError\n|\n|  HTTPError\n|\n|  URLError\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  annotations = {}\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from LazyModule:\n|\n|  dir(self)\n|      dir() -> list\n|      specialized dir() implementation\n|\n|  init(self, name)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.module:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.module:\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 inherited from builtins.module:\n|\n|  dict\n"
                },
                {
                    "name": "class Module_six_moves_urllib_parse",
                    "content": "|  Modulesixmovesurllibparse(name)\n|\n|  Lazy loading of moved objects in six.moves.urllibparse\n|\n|  Method resolution order:\n|      Modulesixmovesurllibparse\n|      LazyModule\n|      builtins.module\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  ParseResult\n|\n|  SplitResult\n|\n|  parseqs\n|\n|  parseqsl\n|\n|  quote\n|\n|  quoteplus\n|\n|  splitquery\n|\n|  splittag\n|\n|  splituser\n|\n|  splitvalue\n|\n|  unquote\n|\n|  unquoteplus\n|\n|  unquotetobytes\n|\n|  urldefrag\n|\n|  urlencode\n|\n|  urljoin\n|\n|  urlparse\n|\n|  urlsplit\n|\n|  urlunparse\n|\n|  urlunsplit\n|\n|  usesfragment\n|\n|  usesnetloc\n|\n|  usesparams\n|\n|  usesquery\n|\n|  usesrelative\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  annotations = {}\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from LazyModule:\n|\n|  dir(self)\n|      dir() -> list\n|      specialized dir() implementation\n|\n|  init(self, name)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.module:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.module:\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 inherited from builtins.module:\n|\n|  dict\n"
                },
                {
                    "name": "class Module_six_moves_urllib_request",
                    "content": "|  Modulesixmovesurllibrequest(name)\n|\n|  Lazy loading of moved objects in six.moves.urllibrequest\n|\n|  Method resolution order:\n|      Modulesixmovesurllibrequest\n|      LazyModule\n|      builtins.module\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  AbstractBasicAuthHandler\n|\n|  AbstractDigestAuthHandler\n|\n|  BaseHandler\n|\n|  CacheFTPHandler\n|\n|  FTPHandler\n|\n|  FancyURLopener\n|\n|  FileHandler\n|\n|  HTTPBasicAuthHandler\n|\n|  HTTPCookieProcessor\n|\n|  HTTPDefaultErrorHandler\n|\n|  HTTPDigestAuthHandler\n|\n|  HTTPErrorProcessor\n|\n|  HTTPHandler\n|\n|  HTTPPasswordMgr\n|\n|  HTTPPasswordMgrWithDefaultRealm\n|\n|  HTTPRedirectHandler\n|\n|  HTTPSHandler\n|\n|  OpenerDirector\n|\n|  ProxyBasicAuthHandler\n|\n|  ProxyDigestAuthHandler\n|\n|  ProxyHandler\n|\n|  Request\n|\n|  URLopener\n|\n|  UnknownHandler\n|\n|  buildopener\n|\n|  getproxies\n|\n|  installopener\n|\n|  parsehttplist\n|\n|  parsekeqvlist\n|\n|  pathname2url\n|\n|  proxybypass\n|\n|  url2pathname\n|\n|  urlcleanup\n|\n|  urlopen\n|\n|  urlretrieve\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  annotations = {}\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from LazyModule:\n|\n|  dir(self)\n|      dir() -> list\n|      specialized dir() implementation\n|\n|  init(self, name)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.module:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.module:\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 inherited from builtins.module:\n|\n|  dict\n"
                },
                {
                    "name": "class Module_six_moves_urllib_response",
                    "content": "|  Modulesixmovesurllibresponse(name)\n|\n|  Lazy loading of moved objects in six.moves.urllibresponse\n|\n|  Method resolution order:\n|      Modulesixmovesurllibresponse\n|      LazyModule\n|      builtins.module\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  addbase\n|\n|  addclosehook\n|\n|  addinfo\n|\n|  addinfourl\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  annotations = {}\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from LazyModule:\n|\n|  dir(self)\n|      dir() -> list\n|      specialized dir() implementation\n|\n|  init(self, name)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.module:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.module:\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 inherited from builtins.module:\n|\n|  dict\n"
                },
                {
                    "name": "class Module_six_moves_urllib_robotparser",
                    "content": "|  Modulesixmovesurllibrobotparser(name)\n|\n|  Lazy loading of moved objects in six.moves.urllibrobotparser\n|\n|  Method resolution order:\n|      Modulesixmovesurllibrobotparser\n|      LazyModule\n|      builtins.module\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  RobotFileParser\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  annotations = {}\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from LazyModule:\n|\n|  dir(self)\n|      dir() -> list\n|      specialized dir() implementation\n|\n|  init(self, name)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.module:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.module:\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 inherited from builtins.module:\n|\n|  dict\n"
                },
                {
                    "name": "class MovedAttribute",
                    "content": "|  MovedAttribute(name, oldmod, newmod, oldattr=None, newattr=None)\n|\n|  Method resolution order:\n|      MovedAttribute\n|      LazyDescr\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  init(self, name, oldmod, newmod, oldattr=None, newattr=None)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from LazyDescr:\n|\n|  get(self, obj, tp)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from LazyDescr:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n"
                },
                {
                    "name": "class MovedModule",
                    "content": "|  MovedModule(name, old, new=None)\n|\n|  Method resolution order:\n|      MovedModule\n|      LazyDescr\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  getattr(self, attr)\n|\n|  init(self, name, old, new=None)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from LazyDescr:\n|\n|  get(self, obj, tp)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from LazyDescr:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n"
                }
            ]
        },
        "FUNCTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "add_metaclass",
                    "content": "Class decorator for creating a class with a metaclass.\n"
                },
                {
                    "name": "add_move",
                    "content": "Add an item to six.moves.\n\nadvanceiterator = next(...)\nnext(iterator[, default])\n\nReturn the next item from the iterator. If default is given and the iterator\nis exhausted, it is returned instead of raising StopIteration.\n"
                },
                {
                    "name": "assertCountEqual",
                    "content": ""
                },
                {
                    "name": "assertNotRegex",
                    "content": ""
                },
                {
                    "name": "assertRaisesRegex",
                    "content": ""
                },
                {
                    "name": "assertRegex",
                    "content": ""
                },
                {
                    "name": "b",
                    "content": "Byte literal\n"
                },
                {
                    "name": "callable",
                    "content": "Return whether the object is callable (i.e., some kind of function).\n\nNote that classes are callable, as are instances of classes with a\ncall() method.\n"
                },
                {
                    "name": "create_unbound_method",
                    "content": ""
                },
                {
                    "name": "ensure_binary",
                    "content": "Coerce s to six.binarytype.\n\nFor Python 2:\n- `unicode` -> encoded to `str`\n- `str` -> `str`\n\nFor Python 3:\n- `str` -> encoded to `bytes`\n- `bytes` -> `bytes`\n"
                },
                {
                    "name": "ensure_str",
                    "content": "Coerce *s* to `str`.\n\nFor Python 2:\n- `unicode` -> encoded to `str`\n- `str` -> `str`\n\nFor Python 3:\n- `str` -> `str`\n- `bytes` -> decoded to `str`\n"
                },
                {
                    "name": "ensure_text",
                    "content": "Coerce *s* to six.texttype.\n\nFor Python 2:\n- `unicode` -> `unicode`\n- `str` -> `unicode`\n\nFor Python 3:\n- `str` -> `str`\n- `bytes` -> decoded to `str`\n\nexec = exec(source, globals=None, locals=None, /)\nExecute the given source in the context of globals and locals.\n\nThe source may be a string representing one or more Python statements\nor a code object as returned by compile().\nThe globals must be a dictionary and locals can be any mapping,\ndefaulting to the current globals and locals.\nIf only globals is given, locals defaults to it.\n"
                },
                {
                    "name": "get_unbound_function",
                    "content": "Get the function out of a possibly unbound function\n\nindexbytes = getitem(a, b, /)\nSame as a[b].\n\nint2byte = pack(...) method of struct.Struct instance\nS.pack(v1, v2, ...) -> bytes\n\nReturn a bytes object containing values v1, v2, ... packed according\nto the format string S.format.  See help(struct) for more on format\nstrings.\n\niterbytes = iter(...)\niter(iterable) -> iterator\niter(callable, sentinel) -> iterator\n\nGet an iterator from an object.  In the first form, the argument must\nsupply its own iterator, or be a sequence.\nIn the second form, the callable is called until it returns the sentinel.\n"
                },
                {
                    "name": "iteritems",
                    "content": "Return an iterator over the (key, value) pairs of a dictionary.\n"
                },
                {
                    "name": "iterkeys",
                    "content": "Return an iterator over the keys of a dictionary.\n"
                },
                {
                    "name": "iterlists",
                    "content": "Return an iterator over the (key, [values]) pairs of a dictionary.\n"
                },
                {
                    "name": "itervalues",
                    "content": "Return an iterator over the values of a dictionary.\n"
                },
                {
                    "name": "next",
                    "content": "next(iterator[, default])\n\nReturn the next item from the iterator. If default is given and the iterator\nis exhausted, it is returned instead of raising StopIteration.\n\nprint = print(...)\nprint(value, ..., sep=' ', end='\\n', file=sys.stdout, flush=False)\n\nPrints the values to a stream, or to sys.stdout by default.\nOptional keyword arguments:\nfile:  a file-like object (stream); defaults to the current sys.stdout.\nsep:   string inserted between values, default a space.\nend:   string appended after the last value, default a newline.\nflush: whether to forcibly flush the stream.\n"
                },
                {
                    "name": "python_2_unicode_compatible",
                    "content": "A class decorator that defines unicode and str methods under Python 2.\nUnder Python 3 it does nothing.\n\nTo support Python 2 and 3 with a single code base, define a str method\nreturning text and apply this decorator to the class.\n"
                },
                {
                    "name": "raise_from",
                    "content": ""
                },
                {
                    "name": "remove_move",
                    "content": "Remove item from six.moves.\n"
                },
                {
                    "name": "reraise",
                    "content": "Reraise an exception.\n"
                },
                {
                    "name": "u",
                    "content": "Text literal\n\nunichr = chr(i, /)\nReturn a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff.\n"
                },
                {
                    "name": "with_metaclass",
                    "content": "Create a base class with a metaclass.\n"
                }
            ]
        },
        "DATA": {
            "content": "MAXSIZE = 9223372036854775807\nPY2 = False\nPY3 = True\nPY34 = True\nabsoluteimport = Feature((2, 5, 0, 'alpha', 1), (3, 0, 0, 'alpha', 0...\nbyte2int = operator.itemgetter(0)\nclasstypes = (<class 'type'>,)\ngetfunctionclosure = operator.attrgetter('closure')\ngetfunctioncode = operator.attrgetter('code')\ngetfunctiondefaults = operator.attrgetter('defaults')\ngetfunctionglobals = operator.attrgetter('globals')\ngetmethodfunction = operator.attrgetter('func')\ngetmethodself = operator.attrgetter('self')\nintegertypes = (<class 'int'>,)\nstringtypes = (<class 'str'>,)\nviewitems = operator.methodcaller('items')\nviewkeys = operator.methodcaller('keys')\nviewvalues = operator.methodcaller('values')\n",
            "subsections": []
        },
        "VERSION": {
            "content": "1.16.0\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Benjamin Peterson <benjamin@python.org>\n",
            "subsections": []
        },
        "FILE": {
            "content": "/usr/lib/python3/dist-packages/six.py\n\n",
            "subsections": []
        }
    },
    "summary": "six - Utilities for writing code that runs on Python 2 and 3",
    "flags": [],
    "examples": [],
    "see_also": []
}