I am parsing an Excel spreadsheet with this code:
for row_idx in range(2, db_sheet.nrows):
press_id = str(db_sheet.cell(row_idx, 0).value)
press_name = 'Inj ' + press_id[3]
try:
press_name = 'Inj ' + press_id[3] + press_id[4]
except:
pass
In the spreadsheet the names will be from 'INJ1' to 'INJ10'. How to write this code correctly, so I don't have to leave empty except
?