List Slicing (1) 썸네일형 리스트형 [Error] Why does substring slicing with index out of range work? Question : Why doesn't example[999:9999] result in error? Since example[999] does, what is the motivation behind it? Answer : [999:9999] isn't an index, it's a slice, and has different semantics. From the python intro : "Degenerate slice indices are handled gracefully : an index that is too large is replaced by the string size, an upper bound smaller than the lower bound returns an empty string".. 이전 1 다음