I extract some values from excel sheet as list. list = [cap-0101-01010, ture-adb-0111-110, bean-KG-0101-2020, fire-Good-2020191, good-9092929, memory-2020939-KGY, excute-odo-2020393, .... , ending-doo-9090922]
If there is matched string in the list with specific string(ex: XY CUTE BGN-excute-odo-2020393), then return excute-odo-2020393 in the list.
Here is my code, but it is not working.
list = []
cnt = 0
book1 = xlrd.open_workbook('D:/@. ex.xlsx')
sheet = book1.sheet_by_name('List')
for rowidx in range(sheet.nrows):
row = sheet.row(rowidx)
for colidx, cell in enumerate(row):
list.append(str(cell.value))
book1.release_resources()
del book1
tmp = ''
for mfr in list:
if mfr in safetyreportid:
tmp = mfr
print(mfr)
print(tmp)
And below is the error message when I execute aboce source code.
Traceback (most recent call last): File "C:\Users\AB\Desktop\parser.py", line 99, in print(mfr) UnicodeEncodeError: 'cp949' codec can't encode character '\xa0' in position 0: illegal multibyte sequence
In excel sheet, there is space like below, then, in the row of apple, the error is occured
banana
apple
orange