s=”中文abc” //utf8编码 su=u”中文abc” //unicode 编码 若要想将s编码成utf8,必须要求s是Unicode编码。 s.encode(“utf8”)错误 s.decode(“gb2312”).encode(“utf8”); //先将s解码,(gb2312是s的系统编码方式)python会解码成unicode码,然后编码成utf8.