Python - Introduction Getting Help

Introduction

You can always call the built-in dir function to get methods defined on an object.

This function lists variables assigned in the caller's scope when called with no argument.

It returns a list of all the attributes available for any object passed to it.

S="a"
dir(S) 

Result

In general, leading 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 methods' names.

To ask what they do, you can pass them to the help function:

help(S.replace) 
Help on built-in function replace: 
replace(...) 
    S.replace(old, new[, count]) -> str 

    Return a copy of S with all occurrences of substring 
    old replaced by new.  If the optional argument count is 
    given, only the first count occurrences are replaced.