欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

pyspider源代码-run.py six模块

程序员文章站 2022-05-14 15:54:28
...

[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提供了一个同一个的接口。