table string methods # syntax description capitalize(returns copy of str with the first letter capitalizedsee also the str title(method returns copy of centered in string of length width padded with spaces or optionally with char ( string of length )see str ljust()str rjust()and str format( center(widthchars count(tstartendreturns the number of occurrences of str in str (or in the start:end slice of sreturns bytes object that represents the string using the default encoding or using the specified encoding and handling errors according to the optional err argument bytes endswith(xstartendreturns true if (or the start:end slice of sends with str or with any of the strings in tuple xotherwisereturns false see also str startswith(character encodings expandtabssizereturns copy of with tabs replaced with spaces in multiples of or of size if specified find(tstartendreturns the leftmost position of in (or in the start:end slice of sor - if not found use str rfind(to find the rightmost position see also str index( formatreturns copy of formatted according to the given arguments this method and its arguments are covered in the next subsection returns the leftmost position of in (or in the start:end slice of sor raises valueerror if not found use str rindex(to search from the right see str find( encodeencodingerrs index(tstartendidentifiers and keywords isalnum(returns true if is nonempty and every character in is alphanumeric isalpha(returns true if is nonempty and every character in is alphabetic isdecimal(returns true if is nonempty and every character in is unicode base digit isdigit(returns true if is nonempty and every character in is an ascii digit isidentifier(returns true if is nonempty and is valid identifier islower(returns true if has at least one lowercaseable character and all its lowercaseable characters are lowercasesee also str isupper(type str format(