[Tutor] Problems importing random on linux
dyoo at hkn.eecs.berkeley.edu
Wed Apr 28 09:11:04 EDT 2004
> >> def generatenumber():
> >> target = random.randint(0,100)
> >> What is going on here? I've tried the same small piece of code:
> >> import random target = random.randing(0,100) at the interpreter and
> >> it works, but if I try this as an application in a file, it fails.
> >> Any ideas ?
> > Do you perhaps have a file named random.py in the same directory as
> > autoguess.py? To me, it sounds like the random module imported is
> > different from the standard library module.
There's just something about the 'random' module that makes people want to
name their own programs 'random'... *grin*
More information about the Tutor