Python random function

前端 未结 9 1110
后悔当初
后悔当初 2020-12-10 03:26

I\'m having problems with Python\'s import random function. It seems that import random and from random import random are importing different thing

9条回答
  •  死守一世寂寞
    2020-12-10 04:17

    If you use from random import random, you must call randint() like so: randint(1,5). If you use import random, you call it like so: random.randint(1,5).

提交回复
热议问题