date = line[4:5]
I want the 3rd and 4th values in the line to be stored as date. When I use the code above, I end up with date = 1, when I want it to be equal to an integer between 00 and 99. How can I do this right
date = line[4:5]
I want the 3rd and 4th values in the line to be stored as date. When I use the code above, I end up with date = 1, when I want it to be equal to an integer between 00 and 99. How can I do this right
Try this:
date = int(line[2:4])
There are two things here:
I'd have a look at Python's datetime utils.