写入这样的文件时出现此错误:
#logo .img {
/* For Firefox specifically */
-moz-transform: scale(0.5,0.5);
/* For the other browsers */
-ms-transform: scale(0.5,0.5);
-webkit-transform: scale(0.5,0.5);
transform: scale(0.5,0.5);
}
问题是我在调用包含Unicode字符和默认" ascii"编码器不知道如何将它们编码为字节。我明白了。
然后我f.write(str(data))
看到了令人讨厌的角色,我看不到任何东西。有没有办法检测到它?感谢。
根据Steven Kryskala的建议,我做了print unicode(data)[13:20]
并得到了这个:
print repr(unicode(data))[13:21]
那有什么不好的?
答案 0 :(得分:0)
替换为此尝试此
f.write(data.encode())