第1个回答 2013-01-07
string.rstrip(s[,
chars])
Return a copy of the string with trailing characters removed. If
chars is omitted or None, whitespace characters are removed. If given and not
None,
chars must be a string; the characters in the string will be stripped from the end of the string this method is called on.
例子:
s='abcdefg'
s=s.strip("asbdg")
print s
结果为'cdef'
默认的是去除空白字符包括' ','\t','\n'等