Created
April 13, 2015 01:44
-
-
Save isvaldo/a85d99a6c2ae25084a05 to your computer and use it in GitHub Desktop.
Gerando palavras aleatórias com python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import random | |
def rd_string(length): | |
""" | |
Criando Strings aleatórias usando casting | |
""" | |
str_rd = "" | |
while(len(str_rd)<=length): | |
str_rd += '%c' % random.randint(97,122) | |
return str_rd | |
# Testing | |
for n in range(0,100): | |
print rd_string(n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment