On 6 Jun 2005, [EMAIL PROTECTED] wrote: > > Hello, I'm having a bit of trouble resizing/reshaping an array of strings. > here's what I'm trying to do: > > myString = ['hi','my','name','is','Jeff'] > reshape(myString, (2,2)) > > What I get from this is something like: > > [['h','i'], > ['m','y']] > > What I want is: > [['hi','my'], > ['name','is']]
If you explained exactly what you want (and showed what you tried to do) it would be easier to help. What does e.g. the tuple `(2,2)' mean? Here's is an example which should give you an idea how to solve the problem: . >>> s = ['hi','my','name','is','Jeff'] . >>> s[0:2] . ['hi', 'my'] . >>> s[2:4] . ['name', 'is'] Your reshape function just has to create the list slices. Karl -- Please do *not* send copies of replies to me. I read the list _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor