s[-1]和s[len(s)-1]

Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>> 
>>> s='xiaodeng'
>>> s[-1]
'g'
>>> s[len(s)-1]
'g'
>>> s[-2]
'n'
>>> s[len(s)-2]
'n'
>>> 
原文地址:https://www.cnblogs.com/dengyg200891/p/4894257.html