Movatterモバイル変換


[0]ホーム

URL:


__sub__ for string

Fredrik Lundhfredrik at pythonware.com
Fri Apr 13 05:22:05 EDT 2001


Rikard Bosnjakovic wrote:> I mean, it wasn't much code:>> import UserString>> class mystr(UserString.UserString):>     def __init__(self, data=""):>         self.data = data>     def __sub__(self, other):>         return self.data.replace(other, "")you mean "if self.data.endswith(other): return self.data[-len(other):]",don't you?Cheers /F


More information about the Python-listmailing list

[8]ページ先頭

©2009-2025 Movatter.jp