Hello World-ish

Jorge Godoy godoy at ieee.org
Sat Nov 26 06:31:25 EST 2005


"ludvig.ericson at gmail.com" <ludvig.ericson at gmail.com> writes:

> from os import *
> print "Working path: %s" % os.getcwd();
> 
> Just wondering how you would do that .. in theory, if you get what I
> mean?
> I get
> NameError: name 'os' is not defined
> currently, which I don't know how to fix.. anyone?

Either:

import os

or

print "Working path: %s" % getcwd();



Avoid "from <module> import *" always when you can (there are still modules
designed to work with it).  It pollutes namespace and might lead to
undesirable clobbing of data structures (is it your 'getId' method or the
module's that is being used? ;-)).



Be seeing you,
-- 
Jorge Godoy      <godoy at ieee.org>



More information about the Python-list mailing list