I have a number of excel files. In each file DATE is represented by different name. I want to read the date from those different file. Also the date is in different column in different file.
To identify the date field in different files I have created a file called _globals where I keep all aliases for DATE in a array called 'alias_DATE'. Array alias_DATE looks like, alias_DATE=['TRADEDATE', 'Accounting Date', 'Date de VL','Datum', 'Kurs-datum', 'Date', 'Fecha Datos', 'Calculation Date', 'ClosingDate', 'Pricing Date', 'NAV Date', 'NAVDate', 'NAVDATE', 'ValuationDate', 'Datestamp', 'Fecha de ValoraciĆ³n', 'Kurs-','datum', """Kurs-\ndatum""", "Kurs-\ndatum"] Now I want the index of the column where date is there. I followed the with followin code. >>> b=xlrd.open_workbook('Santander_051206.xls') >>> sh=b.sheet_by_index(0) >>> sh.cell_value(rowx=0, colx=11) u'Fecha de Valoraci\xf3n' >>> val=sh.cell_value(rowx=0, colx=11) >>> val u'Fecha de Valoraci\xf3n' >>> print val Fecha de ValoraciĆ³n >>> import _globals # the file where I have stored my 'alias_DATE' >>> array >>> _globals.alias_DATE.index(val) Traceback (most recent call last): File "<interactive input>", line 1, in ? UnicodeDecodeError: 'ascii' codec can't decode byte 0xf3 in position 17: ordinal not in range(128) >>> Though I have matching value in the array, why I am getting this error. Can any one please tell me why is this error, and how to get rid of this error. Because I have some files which containing some more special characters. Thank you in advance. Sudhir. -- http://mail.python.org/mailman/listinfo/python-list