美文网首页
pyspider源代码-run.py six模块

pyspider源代码-run.py six模块

作者: comboo | 来源:发表于2017-03-26 17:25 被阅读75次

    [run文档]https://github.com/binux/pyspider/blob/master/pyspider/run.py

    import os
    import sys
    import six
    import copy
    import time
    import shutil
    import logging
    import logging.config
    import click
    import pyspider

    six

    six.iteritems

    Returns an iterator over dictionary‘s items. This replaces dictionary.iteritems() on Python 2 and dictionary.items() on Python 3. kwargs are passed through to the underlying method.

    返回词典参数的迭代。代理python2中dictionary.iteritems()和python3中dictionary.items()

    >>> import six
    >>> student = {'name':'wang','age':1}
    >>> for s in six.iteritems(student):
    ...     print s
    

    six.string_types

    Possible types for text data. This is basestring()
    in Python 2 and str in Python 3.

    数据的类型。python2中是basestring()类型,python3中是str类型

    >>> a = 'str'
    >>> isinstance(a, six.string_types)
    True
    >>> a = ['list']
    >>> isinstance(a, six.string_types)
    False
    

    from six.moves import xmlrpc_client

    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. For example, to load the module for parsing HTML on Python 2 or 3, write:

    python3重新组织了标准库,six.moves提供了一个同一个的接口。

    相关文章

      网友评论

          本文标题:pyspider源代码-run.py six模块

          本文链接:https://www.haomeiwen.com/subject/baskottx.html