the methods introduced in the prior section are representativebut smallsample of what is available for string objects in generalthis book is not exhaustive in its look at object methods for more detailsyou can always call the built-in dir function this function lists variables assigned in the caller' scope when called with no argumentmore usefullyit returns list of all the attributes available for any object passed to it because methods are function attributesthey will show up in this list assuming is still the stringhere are its attributes on python (python varies slightly)dir( ['__add__''__class__''__contains__''__delattr__''__dir__''__doc__''__eq__''__format__''__ge__''__getattribute__''__getitem__''__getnewargs__''__gt__''__hash__''__init__''__iter__''__le__''__len__''__lt__''__mod__''__mul__''__ne__''__new__''__reduce__''__reduce_ex__''__repr__''__rmod__''__rmul__''__setattr__''__sizeof__''__str__''__subclasshook__''capitalize''casefold''center''count''encode''endswith''expandtabs''find''format''format_map''index''isalnum''isalpha''isdecimal''isdigit''isidentifier''islower''isnumeric''isprintable''isspace''istitle''isupper''join''ljust''lower''lstrip''maketrans''partition''replace''rfind''rindex''rjust''rpartition''rsplit''rstrip''split''splitlines''startswith''strip''swapcase''title''translate''upper''zfill'you probably won' care about the names with double underscores in this list until later in the bookwhen we study operator overloading in classes--they represent the implementation of the string object and are available to support customization the __add__ method of stringsfor exampleis what really performs concatenationpython maps the first of the following to the second internallythough you shouldn' usually use the second form yourself (it' less intuitiveand might even run slower) 'ni!'spamni! __add__('ni!''spamni!in generalleading and trailing double underscores is the naming pattern python uses for implementation details the names without the underscores in this list are the callable methods on string objects the dir function simply gives the methodsnames to ask what they doyou can pass them to the help functionhelp( replacehelp on built-in function replacereplaces replace(oldnew[count]-str return copy of with all occurrences of substring old replaced by new if the optional argument count is givenonly the first count occurrences are replaced introducing python object types