python报错:
UnicodeDecodeError: 'gbk' codec can't decode byte 0xad in position 14: illegal multibyte sequence
原因:txt是utf-8编码,所以编码需要转为utf-8
1.找到报错的代码行:
f = open('gp.txt','r')
2.将代码改为:
f = open("gp.txt",encoding='utf-8').read()
python报错:
UnicodeDecodeError: 'gbk' codec can't decode byte 0xad in position 14: illegal multibyte sequence
原因:txt是utf-8编码,所以编码需要转为utf-8
1.找到报错的代码行:
f = open('gp.txt','r')
2.将代码改为:
f = open("gp.txt",encoding='utf-8').read()
道可道,非常道;名可名,非常名。 无名,天地之始,有名,万物之母。 故常无欲,以观其妙,常有欲,以观其徼。 此两者,同出而异名,同谓之玄,玄之又玄,众妙之门。