June 2017
Beginner
352 pages
8h 39m
English
Let's go back to our words module and experiment with it further at the REPL. On this occasion we'll import just the module:
$ python3Python 3.5.0 (default, Nov 3 2015, 13:17:02)[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwinType "help", "copyright", "credits" or "license" for more information.>>> import words
The import statement binds a module object to the name words in the current namespace. We can determine the type of any object by using the type() built-in function:
>>> type(words)<class 'module'>
If we want to see the attributes of an object, we can use the dir() built-in function in a Python interactive session to introspect an object:
>>> dir(words)['__builtins__', '__cached__', '__doc__', ...
Read now
Unlock full access