这个方法不是很好,不知道有没有更好的方法 def cut_hz(s, length): charstyle = chardet.detect(s) t = s[:length] try: unicode(t, charstyle['encoding']) except: t = s[:length-1] return t 这样更好一点 def cut_hz(s, length): charstyle = chardet.detect(s) uni_s = unicode(s, charstyle…