我想在python中连接一些字符串(波斯字符串) :
for t in lstres:
with conn:
c = conn.cursor()
q="SELECT fa FROM words WHERE en ='"+t+"'"
c.execute(q)
lst=c.fetchall()
if lst:
W.append(lst)
else:
W.append(t)
cnum=1
for can in W:
cnum=cnum*len(W)
candida=Set()
for ii in range(1,min(20,cnum)):
candid=""
for w in W:
candid+=str(" "+random.choice (w)[0]).encode('utf-8')
candida.add(candid)
但它说:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd8 in position 1: ordinal not in range(128)
问题是什么 ?