def rand_str(min_char=MIN_CHR, max_char=MAX_CHR, min_len=MIN_STRLEN, 
             max_len=MAX_STRLEN, func=chr, **kwargs):
    '''For values in the (extended) ASCII range, regardless of Python version.
    '''
    l = randint(min_len, max_len)

    ret = ''
    for k in xrange(l):
        ret += func(randint(min_char, max_char))
    return ret
def rand_str ( min_char = MIN_CHR , max_char = MAX_CHR , min_len = MIN_STRLEN , max_len = MAX_STRLEN , func = chr , ** kwargs ) : l = randint ( min_len , max_len ) ret = '' for k in xrange ( l ) : ret += func ( randint ( min_char , max_char ) ) return ret
For values in the (extended) ASCII range, regardless of Python version.