At 02:25 PM 8/30/2005 -0400, Raymond Hettinger wrote: >That case should be handled with consecutive partitions: > ># keep everything after the second 'X' >head, found, s = s.partition('X') >head, found, s = s.partition('x') Or: s=s.partition('X')[2].partition('X')[2] which actually suggests a shorter, clearer way to do it: s = s.after('X').after('X') And the corresponding 'before' method, of course, such that if sep in s: s.before(sep), sep, s.after(sep) == s.partition(sep) Technically, these should probably be before_first and after_first, with the corresponding before_last and after_last corresponding to rpartition.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4