最終更新:2021-04-05 (月) 12:40:09 (7d)  

six.moves
Top / six.moves

For the most part, six.moves aliases are the names of the modules in Python 3

概要

  • Python 3 reorganized the standard library and moved several functions to different modules. Six provides a consistent interface to them through the fake six.moves module.

  • When the new Python 3 name is a package, the components of the name are separated by underscores.
  • For example, html.parser becomes html_parser.

パース

  • For example, to load the module for parsing HTML on Python 2 or 3, write:
  • from six.moves import html_parser?

リロード

  • importlib?
    from six.moves import reload_module

サーバ

  • For example, BaseHTTPServer which is in http.server? in Python 3 is aliased as BaseHTTPServer.

supported renames

  • NamePython 2 namePython 3 name
    builtins()Python/__builtin__()Python/builtins?()
    configparser()Python/ConfigParser?()Python/configparser?()
    copyreg()Python/copy_reg?()Python/copyreg?()
    cPickle()Python/cPickle?()Python/pickle()
    cStringIO()Python/cStringIO.StringIO?()Python/io.StringIO?()
    collections_abc()Python/collections()Python/collections.abc (3.3+)?()
    dbm_gnu()Python/gdbm?()Python/dbm.gnu?()
    dbm_ndbm()Python/dbm()Python/dbm.ndbm?()
    _dummy_thread()Python/dummy_thread?()Python/_dummy_thread? (< 3.9) Python/_thread? (3.9+)()
    email_mime_base()Python/email.MIMEBase?()Python/email.mime.base?()
    email_mime_image()Python/email.MIMEImage?()Python/email.mime.image?()
    email_mime_multipart()Python/email.MIMEMultipart?()Python/email.mime.multipart?()
    email_mime_nonmultipart()Python/email.MIMENonMultipart?()Python/email.mime.nonmultipart?()
    email_mime_text()Python/email.MIMEText?()Python/email.mime.text?()
    filter()Python/itertools.ifilter?()Python/filter?()
    filterfalse()Python/itertools.ifilterfalse?()Python/itertools.filterfalse?()
    getcwd()Python/os.getcwdu?()Python/os.getcwd?()
    getcwdb()Python/os.getcwd?()Python/os.getcwdb?()
    getoutput()Python/commands.getoutput?()Python/subprocess.getoutput?()
    http_cookiejar()Python/cookielib?()Python/http.cookiejar?()
    http_cookies()Python/Cookie?()Python/http.cookies?()
    html_entities()Python/htmlentitydefs?()Python/html.entities?()
    html_parser()Python/HTMLParser?()Python/html.parser?()
    http_client()Python/httplib?()Python/http.client?()
    BaseHTTPServer()Python/BaseHTTPServer?()Python/http.server()
    CGIHTTPServer()Python/CGIHTTPServer?()Python/http.server()
    SimpleHTTPServer()Python/SimpleHTTPServer?()Python/http.server()
    input()Python/raw_input?()Python/input()
    intern()Python/intern?()Python/sys.intern?()
    map()Python/itertools.imap?()Python/map()
    queue()Python/Queue?()Python/queue()
    range()Python/xrange?()Python/range()
    reduce()Python/reduce?()Python/functools.reduce?()
    reload_module()Python/reload?()Python/imp.reload?(), Python/importlib.reload?() on Python 3.4+()
    reprlib()Python/repr?()Python/reprlib?()
    shlex_quote()Python/pipes.quote?()Python/shlex.quote?()
    socketserver()Python/SocketServer?()Python/socketserver?()
    _thread()Python/thread?()Python/_thread?()
    tkinter()Python/Tkinter?()Python/tkinter?()
    tkinter_dialog()Python/Dialog?()Python/tkinter.dialog?()
    tkinter_filedialog()Python/FileDialog?()Python/tkinter.FileDialog?()
    tkinter_scrolledtext()Python/ScrolledText?()Python/tkinter.scrolledtext?()
    tkinter_simpledialog()Python/SimpleDialog?()Python/tkinter.simpledialog?()
    tkinter_ttk()Python/ttk?()Python/tkinter.ttk?()
    tkinter_tix()Python/Tix?()Python/tkinter.tix?()
    tkinter_constants()Python/Tkconstants?()Python/tkinter.constants?()
    tkinter_dnd()Python/Tkdnd?()Python/tkinter.dnd?()
    tkinter_colorchooser()Python/tkColorChooser?()Python/tkinter.colorchooser?()
    tkinter_commondialog()Python/tkCommonDialog?()Python/tkinter.commondialog?()
    tkinter_tkfiledialog()Python/tkFileDialog?()Python/tkinter.filedialog?()
    tkinter_font()Python/tkFont?()Python/tkinter.font?()
    tkinter_messagebox()Python/tkMessageBox?()Python/tkinter.messagebox?()
    tkinter_tksimpledialog()Python/tkSimpleDialog?()Python/tkinter.simpledialog?()
    urllib.parse()See six.moves.urllib.parse?()Python/urllib.parse?()
    urllib.error()See six.moves.urllib.error?()Python/urllib.error?()
    urllib.request()See six.moves.urllib.request?()urllib.request?()
    urllib.response()See six.moves.urllib.response?()urllib.response?()
    urllib.robotparser()Python/robotparser?()urllib.robotparser?()
    urllib_robotparser()Python/robotparser?()Python/urllib.robotparser?()
    UserDict?()Python/UserDict.UserDict?()collections.UserDict?()
    UserList?()Python/UserList.UserList?()collections.UserList?()
    UserString?()Python/UserString.UserString?()collections.UserString?()
    winreg()Python/_winreg?()Python/winreg?()
    xmlrpc_client()Python/xmlrpclib?()Python/xmlrpc.client?()
    xmlrpc_server()Python/SimpleXMLRPCServer?()Python/xmlrpc.server?()
    xrange()Python/xrange?()Python/range()
    zip()Python/itertools.izip?()Python/zip?()
    zip_longest()Python/itertools.izip_longest?()Python/itertools.zip_longest?()