空的字符串【‘’】为什么用【:1】,不能用【0】
Topic source再比如:
>>> ''[0]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: string index out of range
>>> ''[:1]
''
- 1
再比如:
>>> ''[0]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: string index out of range
>>> ''[:1]
''
做回自己ZXH
>>> ''[0]==' '
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: string index out of range
>>> ''[:1]==' '
False