Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

I. Learning to Program > 10. Useful Python Modules

Chapter 10. Useful Python Modules

As you learned in Chapter 7, a Python module is any combination of functions, classes, and variables. Python uses modules to group functions and classes in order to make them easier to use. For example, the turtle module, which we used in previous chapters, groups functions and classes that are used to create a canvas for a turtle to draw on the screen.

When you import a module into a program, you can use all of its contents. For example, when we imported the turtle module in Chapter 4, we had access to the Pen class, which we used to create an object representing the turtle’s canvas:

>>> import turtle
>>> t = turtle.Pen()

Python has a lot of modules for doing all sorts of different tasks. In this chapter, we’ll look at some of the most useful ones and try some of their functions.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint