random.random - Interpreter works, Script doesn't?

Peter Otten __peter__ at web.de
Mon Mar 15 17:53:48 CET 2004


Bill wrote:

> Pay up :-) Cut and pasted from script:
> 
> import random
> 
> for i in range(10):
>     x = random.random()
>     print x
> 
> Other ideas? Thanks!

You didn't name the above script random.py, did you :-)

You would then import the script itself, and the variable named random is
again bound to the script itself, i. e. a module.

When you clean up, also make sure that there is no random.pyc or random.pyo
left over in the script directory.

Peter




More information about the Python-list mailing list