may be given negative valuesin which case the index is taken from the end of the string the translate(method is used to perform advanced character substitutions such as quickly stripping all control characters out of string as an argumentit accepts translation table containing one-to-one mapping of characters in the original string to characters in the result for -bit stringsthe translation table is -character string for unicodethe translation table can be any sequence object where [nreturns an integer character code or unicode character corresponding to the unicode character with integer value the encode(and decode(methods are used to transform string data to and from specified character encoding as inputthese accept an encoding name such as 'ascii''utf- 'or 'utf- these methods are most commonly used to convert unicode strings into data encoding suitable for / operations and are described further in "input and output be aware that in python the encode(method is only available on stringsand the decode(method is only available on the bytes datatype the format(method is used to perform string formatting as argumentsit accepts any combination of positional and keyword arguments placeholders in denoted by {itemare replaced by the appropriate argument positional arguments can be referenced using placeholders such as { and { keyword arguments are referenced using placeholder with name such as {namehere is an examplea "your name is { and your age is {age} format("mike"age= 'your name is mike and your age is within the special format stringsthe {itemplaceholders can also include simple index and attribute lookup placeholder of {item[ ]where is number performs sequence lookup on item placeholder of {item[key]where key is nonnumeric string performs dictionary lookup of item["key" placeholder of {item attrrefers to attribute attr of item further details on the format(method can be found in the "string formattingsection of table string methods method description capitalize( center(width [pad]capitalizes the first character centers the string in field of length width pad is padding character counts occurrences of the specified substring sub decodes string and returns unicode string (byte strings onlyreturns an encoded version of the string (unicode strings onlychecks the end of the string for suffix replaces tabs with spaces finds the first occurrence of the specified substring sub or returns - count(sub [,start [,end]] decode([encoding [,errors]] encode([encoding [,errors]] endswith(suffix [,start [,end]] expandtabs([tabsize] find(sub [start [,end]] lib fl ff