cinap_lenrekadd hg and python4bb9e2215 years agoHistory
529 lines · 16.3 KB · Python
RawDownload
     Return a copy of the string s with only its first character    capitalized.     """    return s.capitalize() # Substring replacement (global)def replace(s, old, new, maxsplit=-1):    """replace (str, old, new[, maxsplit]) -> string     Return a copy of string str with all occurrences of substring    old replaced by new. If the optional argument maxsplit is    given, only the first maxsplit occurrences are replaced.     """    return s.replace(old, new, maxsplit)  # Try importing optional built-in module "strop" -- if it exists,# it redefines some string operations that are 100-1000 times faster.# It also defines values for whitespace, lowercase and uppercase# that match <ctype.h>'s definitions. try:    from strop import maketrans, lowercase, uppercase, whitespace    letters = lowercase + uppercaseexcept ImportError:    pass                                          # Use the original versions

Lines 501–529 of 529. Previous lines