str.rstrip([chars])
chars -- 提供必須修剪字元
#!/usr/bin/python3 str = " this is string example....wow!!! " print (str.rstrip()) str = "*****this is string example....wow!!!*****" print (str.rstrip('*'))
this is string example....wow!!! *****this is string example....wow!!!