Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有人可以解释为什么下面的切片有效吗?
>>> S='SPAM' >>> S[1:1] ''
因为选择一个空切片是合法的。
您甚至可以选择无意义的切片:
>>> 'foo'[1:0] ''