と を使用xlrd
してcx_freeze
います。
Excelファイルから読み取ろうとすると、「、」マークになるとエラーが表示されます。
UnicodeEncodeError: 'charmap' codec can't encode character "\u2019" in position 12: character maps to <undefined>
from xlrd3 import *
book= open_workbook('s1.xls')
sheet=book.sheet_by_index(0)
import sys
from encodings import *
from codecs import *
def pr():
global row,col
if isinstance((sheet.cell(row,col).value), float):
cell = sheet.cell(row,col)
cell_value = cell.value
cell_value1= int(cell.value)
s=[]
s.append(cell_value1)
print (s)
s=[]
else:
cell = sheet.cell(row,col)
cell_value = cell.value
s=[]
s.append(cell_value)
print (s)
s=[]
def co():
x=input("'S'earch again or 'Q'uite?: ")
if x == 'S' or x=='s':
search()
elif x == 'Q'or x == 'q':
sys.exit(0)
else:
print ('Please enter a Vailed answer: ')
co()
def search():
global row,col
s=[]
a=(input("Enter Search : "))
for row in range(sheet.nrows):
for col in range(sheet.ncols):
s.append(str(sheet.cell(row,col).value))
if a in (str(sheet.cell(row,col).value)):
for col in range(sheet.ncols):
pr()
else:
s=[]
co()
search()
これがコードです