Empty Monty Empty Monty - 9 months ago 49
Python Question

Importing and using modules in python

New to python and trying to do a random number generator. However, I am having trouble importing the random module. I get a AttributeError when I try to use anything from the random module. Thanks for your help.

#!/usr/bin/python -tt

import random

def main():
x = random.randint(1,1000)
print x

if __name__ == '__main__':


You probably have a file named random.py (or pyc) in your current directory. You can find out where the random module you're using comes from by doing this:

import random