Home > Articles > Open Source > Python

  • Print
  • + Share This
This chapter is from the book

2.20 Useful Functions

In this chapter, we have seen some useful built-in functions. We summarize them in Table 2.1 and present a few other useful ones (note that these may not be the full syntax, only what we feel would be useful for you now).

Table 2.1. Useful Built-In Functions for New Python Programmers




Display attributes of object or the names of global variables if no parameter given


Display object’s documentation string in a pretty-printed format or enters interactive help if no parameter given


Convert object to an integer


Return length of object

open(fn, mode)

Open file fn with mode (’r’ = read, ‘w’ = write)

range([[start, ]stop[,step])

Return a list of integers that begin at start up to but not including stop in increments of step; start defaults to 0, and step defaults to 1


Wait for text input from the user, optional prompt string can be provided


Convert object to a string


Return type of object (a type object itself!)

  • + Share This
  • 🔖 Save To Your Account