在2.5版中新增加了一个叫rpartition的函数,看一下说明文档:
rpartition(...)
S.rpartition(sep) -> (head, sep, tail)
Search for the separator sep in S, starting at the end of S, and return
the part before it, the separator itself, and the part after it. If the
separator is not found, return two empty strings and S.
(END)
partition(...)
S.partition(sep) -> (head, sep, tail)
Search for the separator sep in S, and return the part before it,
the se......
阅读全文