[ create a new paste ] login | about

Link: http://codepad.org/hGwXI98O    [ raw code | output | fork ]

Python, pasted on Mar 1:
1
2
3
4
5
6
7
8
import random
import string
def getCode(length = 10, char = string.ascii_uppercase):
 return ''.join(random.choice( char) for x in range(length))

print "6 Random capitals: ", getCode(6)
print "5 Random Other chars:  ", getCode(5, "otherchars") 
print "7 Random Lower chars", getCode(7, string.ascii_lowercase) 


Output:
1
2
3
6 Random capitals:  HRFLIQ
5 Random Other chars:   crhrh
7 Random Lower chars rwcnyua


Create a new paste based on this one


Comments: