Python 3.x python3与python2'的确切等价物是什么;s unicode(v,errors=';ignore';)?

Python 3.x python3与python2'的确切等价物是什么;s unicode(v,errors=';ignore';)?,python-3.x,string,python-2.7,python-unicode,Python 3.x,String,Python 2.7,Python Unicode,python3与python2的unicode(v,errors='ignore')的确切等价物是什么 请注意: v是任何字符串(例如six.string\u类型) errors='ignore'至关重要 谢谢 如果v已经是six.string\u类型的一部分,则v的唯一选项是str。Python3str相当于Python2unicode,因此在将str转换为str时,这种转换是多余的 如果您想将字节(它不是six.string类型的一部分)转换为str,那么您需要b.decode(“utf-8

python3与python2的
unicode(v,errors='ignore')
的确切等价物是什么

请注意:

  • v
    是任何字符串(例如
    six.string\u类型
  • errors='ignore'
    至关重要

  • 谢谢

    如果
    v
    已经是
    six.string\u类型的一部分,则
    v
    的唯一选项是
    str
    。Python3
    str
    相当于Python2
    unicode
    ,因此在将
    str
    转换为
    str
    时,这种转换是多余的

    如果您想将
    字节
    (它不是
    six.string类型
    的一部分)转换为
    str
    ,那么您需要
    b.decode(“utf-8”,errors=“ignore”)
    ,或者只是
    str(b,errors=“ignore”)