+ 1

Does the Import Module shows random strings rather than numbers(randint)?

Alternatively, is there such thing as "random.randstr" in the random module?

16th Jul 2017, 3:15 PM
Pow M. Rigor
Pow M. Rigor - avatar
1 Antwort
+ 2
""" I think not... (but I can be wrong ;P) Anyway, you can easily write a custom function for that purpose: """ import random def randstr(maxlength): s = ''; while maxlength: s += chr(random.randint(32,127)) maxlength -= 1 return s print(randstr(42)) https://code.sololearn.com/c3JWd146RIFq/?ref=app
16th Jul 2017, 4:50 PM
visph
visph - avatar