Import w/ '.' syntax

M

mrstevegross

Remind me: is it possible to craft an import statement like this:
import foo.bar

If so, what's going on here exactly? Is Python looking for a module
called 'bar', in a directory called 'foo', in a search path somewhere?
Or am I totally misunderstanding the import semantics.

Thanks,
--Steve
 
J

Jeff McNeil

Remind me: is it possible to craft an import statement like this:
  import foo.bar

If so, what's going on here exactly? Is Python looking for a module
called 'bar', in a directory called 'foo', in a search path somewhere?
Or am I totally misunderstanding the import semantics.

Thanks,
--Steve

In that specific case, you're looking for a module 'bar' in the 'foo'
package, which should be located somewhere on sys.path.

http://docs.python.org/tutorial/modules.html

That covers it pretty well.

Thanks,

Jeff
mcjeff.blogspot.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top