UnicodeEncodeError: 'ascii' codec can't encode character?

后端 未结 1 1642
猫巷女王i
猫巷女王i 2021-01-03 08:18

I\'m trying to pass big strings of random html through regular expressions and my Python 2.6 script is choking on this:

UnicodeEncodeError: \'ascii\' codec can\'t e

相关标签:
1条回答
  • 2021-01-03 08:26

    Total repetition of your other question here (though here you finally deign to show us CODE from the start, wow!-). Answer is still identical: instead of

            ofile.write(Test + '\n')
    

    do

            ofile.write(Test.encode('utf8') + '\n')
    

    why do you keep repeating this Q, BTW?!

    0 讨论(0)
提交回复
热议问题