From: Jim Weirich Date: 2004-02-24T06:59:10+09:00 Subject: Re: Need examples comparing Ruby to Python David MacQuigg said: > Here is what I would like to say in Python, but can't because > line.split() produces a list, and the subsequent methods don't apply > to lists. I'll bet this would work in Ruby, but I don't know enough > Ruby to say for sure. > > file, length, name, title = line.split('|').strip.split.join() > > The goal is to produce a list of strings with whitespace and newlines > stripped off the ends, and whitespace squeezed out of the middle of > each string. Is this what you want ... file, length, name, title = line.split('|').collect{|it| t.squeeze.strip} -- -- Jim Weirich jim@weirichhouse.org http://onestepback.org ----------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)