constructing related strings strings in python are immutableso none of their methods modify an existing string instance howevermany methods return newly constructed string that is closely related to an existing one table provides summary of such methodsincluding those that replace given pattern with anotherthat vary the case of alphabetic charactersthat produce fixed-width string with desired justificationand that produce copy of string with extraneous characters stripped from either end calling syntax replace(oldnews capitalizes uppers lowers center(widths ljust(widths rjust(widths zfill(widths strips lstrips rstripdescription return copy of with all occurrences of old replaced by new return copy of with its first character having uppercase return copy of with all alphabetic characters in uppercase return copy of with all alphabetic characters in lowercase return copy of spadded to widthcentered among spaces return copy of spadded to width with trailing spaces return copy of spadded to width with leading spaces return copy of spadded to width with leading zeros return copy of swith leading and trailing whitespace removed return copy of swith leading whitespace removed return copy of swith trailing whitespace removed table string methods that produce related strings several of these methods accept optional parameters not detailed in the table for examplethe replace method replaces all nonoverlapping occurrences of the old pattern by defaultbut an optional parameter can limit the number of replacements that are performed the methods that center or justify text use spaces as the default fill character when paddingbut an alternate fill character can be specified as an optional parameter similarlyall variants of the strip methods remove leading and trailing whitespace by defaultbut an optional string parameter designates the choice of characters that should be removed from the ends testing boolean conditions table includes methods that test for boolean property of stringsuch as whether it begins or ends with patternor whether its characters qualify as being alphabeticnumericwhitespaceetc for the standard ascii character setalphabetic characters are the uppercase -zand lowercase -znumeric digits are - and whitespace includes the space charactertab characternewlineand carriage return conventions for what are considered alphabetic and numeric character codes are extended to more general unicode character sets