python编码报错1

报错位置: f.write(title+','+link+'\n')

UnicodeEncodeError: 'gbk' codec can't encode character '\u30fb' in position 5: illegal multibyte sequence

解决办法:f = open('1.txt','w+',encoding='utf-8'),添加encoding编码为非默认

你可能感兴趣的:(python编码报错1)