[Tutor] Re: Readlines code.
Rick Pasotto
rick@niof.net
Tue Jul 1 22:20:02 2003
On Tue, Jul 01, 2003 at 10:07:37PM -0400, Derrick 'dman' Hudson wrote:
>
> There are a few different ways of solving your problem, depending on
> what you want to do and what your constraints are. One possibility is
> this :
>
> words = [s.rstrip().split() for s in f.readlines()]
Much better than what I suggested (though the result is the same).
I need to get used to list comprehensions.
--
"Life's too short for chess." -- H. J. Byron
Rick Pasotto rick@niof.net http://www.niof.net