Skip to content

Latest commit

 

History

History
11 lines (6 loc) · 338 Bytes

11-35-随机数如何操作?.md

File metadata and controls

11 lines (6 loc) · 338 Bytes

11-35-随机数如何操作?

1.首先都要 import random

随机整数: random randint(10002000),有时需要转化成字符串类型:

str(random randint(1000, 2000))

随机字符串:"join( random.sample(‘abcdefghijk’6)),有时前面固定字母了:

'ldh'+".join(random sample(‘abcdefghijk’,6))