03. Finding help and keyboard shortcuts

Like any other command line utilities, Python contains methods for help. To get started with the help utility, type the help() command.

>>> help()
Welcome to Python 3.4's help utility! If this is your first time using Python, you should definitely check out the tutorial on the Internet at http://docs.python.org/3.4/tutorial/. Enter the name of any module, keyword, or topic to get help on writing Python programs and using Python modules. To quit this help utility and return to the interpreter, just type "quit". To get a list of available modules, keywords, symbols, or topics, type "modules", "keywords", "symbols", or "topics". Each module also comes with a one-line summary of what it does; to list the modules whose name or summary contain a given string such as "spam", type "modules spam".

Within this interactive module, you can type commands such as print to open up a view that explains that function.

Let's type in quit or q to close this interactive module and instead work directly from the Python command line.

Help on a certain function call

To get help on a specific function or method directly, use the help() function, with a command inside the parentheses.

>>> help(print)

This will open up a help page that can be navigated by less controls, as outlined below:

Page down
Page up
Summary of more controller commands

Keyboard Shortcuts

Before we get started tinkering with Python, it's important to know how to quickly and efficiently navigate the keyboard. Let's learn some of the most important keyboard navigation shortcuts.

1) Beginning and Ends of lines

Use the Ctrl+A to move to the beginning of the line, and Ctrl+E to move to the end.

2) Moving among characters

Use Ctrl+B or the left arrow to move left one character, or Ctrl+F or the right arrow to move right.

3) Deleting characters

Ctrl+D will delete the next character, while Ctrl+K deletes the rest of the line after the cursor.

You may also use Ctrl+Y to "Yank" the last deleted text. This is essential cutting.

4) Undoing

To undo, use Ctrl+_.

5) History

To go back and forth in history, use Ctrl+r and Ctrl+s respectively.

Try these commands out on your computer and practice them to save time in the future.

Learn to be a Pythonista!

Introducing Python

Learn to be a Pythonista! Try Python

Easy to understand and fun to read, Introducing Python is ideal for beginning programmers as well as those new to the language. Author Bill Lubanovic takes you from the basics to more involved and varied topics, mixing tutorials with cookbook-style code recipes to explain concepts in Python 3. End-of-chapter exercises help you practice what you learned.

$ Check price
39.9939.99Amazon 4.5 logo(37+ reviews)

More Python resources

Aching back from coding all day?

Foam Seat Cushion

Aching back from coding all day? Try Back Problems

This foam seat cushion relieves lowerback pain, numbness and pressure sores by promoting healthy weight distribution, posture and spine alignment. Furthermore, it reduces pressure on the tailbone and hip bones while sitting. Perfect for sitting on the computer desk for long periods of time.

$ Check price
99.9599.95Amazon 4.5 logo(9,445+ reviews)

More Back Problems resources