There is a similar library in Python named ‘IPDB’. It is similar to R’s browser() function.
To import IDPB in python:
import ipdb
ipdb.set_trace()
Use the above-mentioned code to explore more about ipdb.
For example:
from ipdb import launch_ipdb_on_exception
def silly():
my_list = [1,2,3]
for i in xrange(4):
print my_list[i]
if __name__ == "__main__":
with launch_ipdb_on_exception():
silly()
Hope this answer helps.