Hacking Raspberry Pi by Warner Timothy L

Hacking Raspberry Pi by Warner Timothy L

Author:Warner, Timothy L. [Warner, Timothy L.]
Language: eng
Format: epub, pdf
Publisher: Pearson Education
Published: 2013-09-30T21:00:00+00:00


import math

content = dir(math)

content

Now let’s drill into the math module, and you’ll see how to take advantage of a module’s inner content. As an example, let’s work with the sqrt function from the math module:

import math

math.sqrt(25)

With respect to Python programming, a fully qualified function name takes the form of module.function. Thus, after importing the math module, you issue math.sqrt() when you want to run the sqrt() function that is contained in the math module.

Even though you imported the math module, the Python interpreter would get confused and issue an error if you used just sqrt() in your code without qualifying its location.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.