problems loading modules
Robert Kern
robert.kern at gmail.com
Mon Feb 5 01:10:27 EST 2007
Frank wrote:
> Hi,
>
> I have the following weird behavior when I load modules:
>
>
>>>> import random
>>>> print random.randrange(10)
> 8
>
> Everything is fine.
>
>>>> import random
>>>> from numpy import *
>>>>
>>>> print random.randrange(10)
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> AttributeError: 'module' object has no attribute 'randrange'
>
> Here it does not work.
numpy has a subpackage called random. You imported it when you did "from numpy
import *".
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list
mailing list