Changeset 388 for python/vendor/current/Lib/string.py
- Timestamp:
- Mar 19, 2014, 11:11:30 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/vendor/current/Lib/string.py
r2 r388 509 509 510 510 # Substring replacement (global) 511 def replace(s, old, new, max split=-1):512 """replace (str, old, new[, max split]) -> string511 def replace(s, old, new, maxreplace=-1): 512 """replace (str, old, new[, maxreplace]) -> string 513 513 514 514 Return a copy of string str with all occurrences of substring 515 old replaced by new. If the optional argument max splitis516 given, only the first max splitoccurrences are replaced.517 518 """ 519 return s.replace(old, new, max split)515 old replaced by new. If the optional argument maxreplace is 516 given, only the first maxreplace occurrences are replaced. 517 518 """ 519 return s.replace(old, new, maxreplace) 520 520 521 521 … … 602 602 def convert_field(self, value, conversion): 603 603 # do any conversion on the resulting object 604 if conversion == 'r':605 return repr(value)604 if conversion is None: 605 return value 606 606 elif conversion == 's': 607 607 return str(value) 608 elif conversion is None:609 return value610 raise ValueError("Unknown conver ion specifier {0!s}".format(conversion))608 elif conversion == 'r': 609 return repr(value) 610 raise ValueError("Unknown conversion specifier {0!s}".format(conversion)) 611 611 612 612
Note:
See TracChangeset
for help on using the changeset viewer.