Lazo Lab Sign up

Read Python Like a Pro / Errors and help

Lesson 9 of 10

Reading the docs

docs.python.org explains every built-in function with examples. In the terminal, help(thing) shows the same information. Learning to look things up is a superpower.

Key points

  • help(str.split) in the Python shell
  • docs.python.org has a tutorial and library reference
  • Look for the Examples section first
>>> help(len)
Help on built-in function len in module builtins:

len(obj, /)
    Return the number of items in a container.

Your turn

Open the Python shell (python3) and run help(str.replace). Use what you read to replace every 'a' in 'banana' with 'o'.

Watch a video on thisOpens YouTube search results for “Reading the docs” in a new tab

Quiz · +10 XP

What does help(len) show?

Log in to save progress and earn XP.