I've got a list of the next form:
scores = [['W;01 14:43:20'], ['W;01 14:43:40'], ['W;01 14:44:00'], ['W;01 14:44:20'], ['W;01 14:44:40']]
I want to replace semicolons with commas making it different elements of the same list and transform it to this form:
scores_right = [['W', '01 14:43:20'], ['W', '01 14:43:40'], ['W', '01 14:44:00'], ['W', '01:14:44:20'], ['W', '01 14:44:40']]
so that when I convert the second value of each nested list to a datetime
object it wouldn't raise IndexError
:
for line in scores:
time = datetime.datetime.strptime(line[1], '%d %H:%M:%S')
IndexError: list index out of range