Tim Chase wrote:

> >  >>> import random
> >  >>> s = "abcdefg"
> >  >>> data = list(s)
> >  >>> random.shuffle(data)
> >  >>> "".join(data)
> > 'bfegacd'
> >
> > fit you better?
>
> Excellent!  Thanks.  I kept trying to find something like an
> array() function.  Too many languages, too little depth.

>>> from array import array
>>> a = array('c', "abcdefgh")
>>> a
array('c', 'abcdefgh')
>>> import random
>>> random.shuffle(a)
>>> a
array('c', 'gfecdabh')
>>> a.tostring()
'gfecdabh'

</F>



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to