.strip() 

用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。

返回移除字符串头尾指定的字符生成的新字符串。

 

while True:
    print(input().strip("吗?") + "喵!")

运行结果:

 

 

D:\pytest\venv\Scripts\python.exe D:/pytest/test.py
你好
你好喵!
你是小那几!
你是小那几!喵!
你好吗
你好喵!
你不好?
你不好喵!
你吃屎吗?
你吃屎喵!
posted on 2021-08-08 00:50  讲道理好嘛  阅读(54)  评论(0编辑  收藏  举报