I am using xlrd to read a spreadsheet and write to a database. However, there is a cell value which needs to be written to a date column in the database. The cell is a string and I read it as and trying to convert it to MON-YY as follows.
sales_month_val = curr_sheet.cell(1,5).value
print sales_month_val
current_sales_month = datetime.strptime(sales_month_val,'%MMM%-%YY%')
But I keep getting the conversion failed error message. Is the above conversion to datetime correct to convert to MON-YY format?
Thanks, bee
答案 0 :(得分:4)