Hello everyone.
I am hoping someone can help with the below error using Python3.5 in the Windows 10 bash environment. I found the below link which I am not sure if this is related to the issue or not. As I don't fully understand the answer. https://github.com/SethMMorton/natsort/issues/7 Issue, following error is generated after trying to sort a list of strings. description.sort() TypeError: unorderable types: float() < str() Each list items (elements) contain a mixture of alpha chars, numbers, punctuation chars like / and are in a string type. Below is an example extract of the data from the list. ['Description', 'EFTPOS WOOLWORTHS 1294 ", "withdrawal Hudson street 3219"] There is over 2000 such entries. This used to work and now doesn't. Only change to the code was modifying the data variable from a list to a dictionary. Below is the full code: import openpyxl from openpyxl.utils import get_column_letter from more_itertools import unique_everseen # Loding the workbook and names for the sheets. wb = openpyxl.load_workbook("test.xlsx") wss = wb.get_sheet_names() description = [] # all the descriptions data = {} for ws_name in wss: ws = wb.get_sheet_by_name(ws_name) for column in ws.columns: col_data = [] # column list for cell in column: value = cell.value col_data.append(value) # end for cell loop if ws_name == "WestPac": if col_data[0] == 'Credit Amount': num = 1 while num <= (len(col_data) - 1): value = col_data[num] if value: data['Amount'][num] = value else: data['Amount'][num] = data['Amount'][num] * -1 num += 1 # end while num break # end if # end if if col_data[0] in data: data[col_data[0]].extend(col_data[1:-1]) else: data[col_data[0]] = col_data # end for column #end for ws_name description = data['Description'] for i in description: if not str(i): print "not a string") description.sort() I am suspecting it is something to do with the data but cannot track down the cause. Any suggestions on how to debug this? Sean _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor