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' >>>