I have the following code:
# -*- coding: utf-8 -*-
import splinter
import urllib
browser = splinter.Browser('firefox')
miss = ("rúin",)
for i in miss:
browser.visit(link)
browser.fill('word', i)
Which gives me the error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)
How can I resolve this issue?
Use an actual unicode value:
miss = (u"rúin",)
Note the u
before the string literal.
Python otherwise will try to coerce the bytestring to unicode implicitly, using the default codec (ASCII).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.