diff options
author | Raymond Hettinger <python@rcn.com> | 2003-11-26 08:21:35 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2003-11-26 08:21:35 (GMT) |
commit | 4f8f9765766a126ebfff3c81655454821f1ad532 (patch) | |
tree | 90f6c08e42a551b8bb461d191afddaef5e4f0cf4 /Lib/UserString.py | |
parent | bd93b3ea8fd87742dd56c9c1ff514223892e0d4a (diff) | |
download | cpython-4f8f9765766a126ebfff3c81655454821f1ad532.zip cpython-4f8f9765766a126ebfff3c81655454821f1ad532.tar.gz cpython-4f8f9765766a126ebfff3c81655454821f1ad532.tar.bz2 |
Add optional fillchar argument to ljust(), rjust(), and center() string methods.
Diffstat (limited to 'Lib/UserString.py')
-rwxr-xr-x | Lib/UserString.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/UserString.py b/Lib/UserString.py index 730cdba..f28e54c 100755 --- a/Lib/UserString.py +++ b/Lib/UserString.py @@ -60,7 +60,8 @@ class UserString: # the following methods are defined in alphabetical order: def capitalize(self): return self.__class__(self.data.capitalize()) - def center(self, width): return self.__class__(self.data.center(width)) + def center(self, width, *args): + return self.__class__(self.data.center(width, *args)) def count(self, sub, start=0, end=sys.maxint): return self.data.count(sub, start, end) def decode(self, encoding=None, errors=None): # XXX improve this? @@ -97,7 +98,8 @@ class UserString: def istitle(self): return self.data.istitle() def isupper(self): return self.data.isupper() def join(self, seq): return self.data.join(seq) - def ljust(self, width): return self.__class__(self.data.ljust(width)) + def ljust(self, width, *args): + return self.__class__(self.data.ljust(width, *args)) def lower(self): return self.__class__(self.data.lower()) def lstrip(self, chars=None): return self.__class__(self.data.lstrip(chars)) def replace(self, old, new, maxsplit=-1): @@ -106,7 +108,8 @@ class UserString: return self.data.rfind(sub, start, end) def rindex(self, sub, start=0, end=sys.maxint): return self.data.rindex(sub, start, end) - def rjust(self, width): return self.__class__(self.data.rjust(width)) + def rjust(self, width, *args): + return self.__class__(self.data.rjust(width, *args)) def rstrip(self, chars=None): return self.__class__(self.data.rstrip(chars)) def split(self, sep=None, maxsplit=-1): return self.data.split(sep, maxsplit) |