[Tutor] just one question

wesley chun wescpy at gmail.com
Wed Jul 15 20:44:31 CEST 2009


On Wed, Jul 15, 2009 at 8:29 AM, Rich Lovely<roadierich at googlemail.com> wrote:
> 2009/7/15 vince spicer <vinces1979 at gmail.com>:
>>        :
>> import re
>>        :
>>     values = re.split("\s+", line) # split values on spaces EX: ['47', '8',
>
> That isn't what they're after at all.
> Something more like
>         :
>        n, pos, ala, at, symb, weight, rad, count = line.split()
>         :


on a side note, i also discourage the use of regular expressions for
this problem when a simpler solution like line.split() will suffice.
bringing up an old jwz quote: 'Some people, when confronted with a
problem, think “I know, I'll use regular expressions.” Now they have
two problems.'

best regards,
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
"Python Fundamentals", Prentice Hall, (c)2009
    http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com


More information about the Tutor mailing list