‘ascii’ codec can’t encode character: ordinal not in range(128) | Python Adventures

‘ascii’ codec can’t encode character: ordinal not in range(128) | Python Adventures

瀏覽:670
日期:2025-04-23
Problem UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 1: ordinal not in range(128) Solution def encode(text): """ For printing unicode characters to the console. """ return text.encode('utf-8') Or: reload(sys) sys.setdef...看更多