Quote:Its a sliceif currentl_line[:2]-- I do not understand the syntax -- what the colon 2 is doing here. Â Is that the following _2 items_ need to be in before the 3rd item(position 2) ? or is it those items need to be before _position 2_ ? Â what is :2 representi
the : represents its a slice and not getting index [2]
Its more like current_line[X:2:X] Â
[start:stop:step]
but you dont need to specify the beginning index of 0, you just leave it empty.In this case there is a 2 atÂ
stop
which means it will get indexes 0 and 1
Recommended Tutorials: