strip() 用于删除字符串首尾的指定字符(默认为空格)或字符序列 str = "AAabcAabcAAA" print(str.strip('A')) #指定字符串A 输出结果 abcAabc 中间的不删除