模块-随机数模块

模块-随机数模块

 

In [72]: random.random()

Out[72]: 0.2341082458388667

 

In [78]: random.randint(1,10)

Out[78]: 10

In [80]: random.randrange(1,5)

Out[80]: 2

 

In [87]: random.choice([1,2,3])

Out[87]: 1

 

 

三个内置函数:

chr()

In [92]: print(chr(88))

X

ord()

In [94]: ord("X")

Out[94]: 88

Isinstance:

In [97]: isinstance({},object)

Out[97]: True

 

In [98]: type({})==object

Out[98]: False

posted @ 2017-10-24 23:20  两只老虎111  阅读(172)  评论(0编辑  收藏  举报