1、截取字符串 字符串的截取的语法格式如下:变量[头下标:尾下标:步长] 倒序的方法 法一: str=input() print(str[::-1]) 结果: 法二: str=input() print(str[-1::-