I am a total noob with Python and seem to be doing something wrong or misunderstand string slicing. Here is the code I wrote to validate how things work:
time1 = '12:30'
print(time1[0])
print(time1[1])
print(time1[2])
print(time1[0:2])
Here is the output that I get:
1 <cr>
2 <cr>
: <cr>
12 <cr>
Shouldn't "print(time1[0:2])" print out the first 3 characters (12:) of the string time1? What am I missing?
Thanks, Greg
Created at: 2019/08/15 22:20; Updated at: 2019/08/16 11:25
The question is resolved.