sql = 'select id from person where name=\''+ data['姓名'][i] +'\''cursor.execute(sql)
data['姓名'][i]是人员姓名,中文,执行报错:
UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 126-131: ordinal not in range(128)
解决办法:
import osos.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8'