I'm trying to write a code to format my excel sheet, but I keep getting a string index out of range error on row 15 (if string[1] == ':':)
It doesn't look like the string is too short either, why am I getting this error?
For anyone who needs it, this is what the excel cell contains: 1 h 5 min
else:
string.replace(' min ', ':')
string = string[0:len(string)-3]
if string[1] == ':':
string.insert(0,'0')
if len(string) == 4:
string.insert(3, '0')
string = '0:' + string
s.write(y, x, string)
y+=1
[edit] ignore when it says string.insert(), it is not a list -- I just messed up -- it's actually a string
Aucun commentaire:
Enregistrer un commentaire