python字符串编码判断

非UTF9编码字符串转换为UTF8
if type(str).__name__!="unicode":
    str=unicode(str,"utf-8")
else:
    pass