def problem

Martijn Faassen m.faassen at vet.uu.nl
Sun Feb 11 19:09:25 EST 2001


Greg Jorgensen <gregj at pobox.com> wrote:
> What you may be trying to do is import the hello module:

> ---
> # hello.py
> def hello():
>     print "hello, world"
> ---

>>>> import hello.py
>>>> hello()
> hello, world!

This won't work. Instead try this (keep hello.py the same):

>>> import hello
>>> hello.hello()

or alternatively:

>>> from hello import hello
>>> hello()

There's also the 'from hello import *' example which I won't demonstrate. :)

Regards,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?



More information about the Python-list mailing list