字符串下标读取
name = 'fty'
print(name[0])
>>> f
倒序读取
name = 'fty'
print(name[-1])
>>> y
print(name[-2])
>>> t
字符串下标如果为负数,即表示从右开始读取
name = 'fty'
print(name[0])
>>> f
name = 'fty'
print(name[-1])
>>> y
print(name[-2])
>>> t
字符串下标如果为负数,即表示从右开始读取