mercredi 14 juin 2017

import error for "random" in python

I am trying to import the module 'random':

from random import shuffle

But I am getting the error: "ImportError: cannot import name shuffle"

Also, if I just do:

import random
random.sample(range(0,10),9)

This also gives an attribute error: "AttributeError: 'module' object has no attribute 'sample'"

I have Python 2.7.5 installed. I am guessing I do not have these modules?

Best regards




Aucun commentaire:

Enregistrer un commentaire