import random import string def generateRandomPort(default): firstLetter = random.choice(string.ascii_letters); lastLetter = random.choice(string.ascii_letters + string.digits); return (default + ord(firstLetter) * ord(lastLetter));