如果函数的返回是一个序列,也可以直接对其进行索引操作str01 = input('year:')[2]print(str01)**注意事项 :**python 没有字符类型,所以通过索引获取到的其实是一个单字符的字符串当你使用负数索引时...ending = ['st', 'nd', 'rd'] + 17 \* ['th'] + ['st', 'nd', 'rd'] + 7 \* ['th'] + ['st']print(ending)year...', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th...', 'th', 'th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'st']Year: 2021Month(1-12)...zheng' print(name.title()) -------- # 输出为:Kai Zheng # 将字符串中的字母全都改为大写:upper() # 将字符串中的字母全都改为小写:lower()