[Tutor] interesting str behavior ... (fwd)

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Fri May 16 13:38:43 2003


[Forwarding to Tutor]



---------- Forwarded message ----------
Date: Fri, 16 May 2003 13:27:49 +0530
From: lonetwin <lonetwin@yahoo.com>
To: Danny Yoo <dyoo@hkn.eecs.berkeley.edu>
Subject: Re: [Tutor] interesting str behavior ...

On Friday 16 May 2003 11:52 am, Danny Yoo wrote:
>
> If we want to make temp 56 elements long, and if we want to do it by using
> append() only, we've got to do something to let us do a repeated append()
> that many times.
>
Re: And that is as easy as rearranging the contruct

>>> temp.append([item for item in letters])

like so:

>>> junk_this = [temp.append(item) for item in letters]
>>> temp
['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D',
'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
>>>

:)
Peace
Steve

-- 
A government that is big enough to give you all you want is big enough
to take it all away.
		-- Barry Goldwater