split question

Grant Edwards grante at visi.com
Thu Apr 28 13:10:20 EDT 2005


On 2005-04-28, alexk <alexk at mailinator.com> wrote:
> I've a simple question. Why the following:
>
> words = "123#@$#$@^%[wordA] wordB#@$".split('~`!@#$%^&*()_+-=[]{},./')
>
> doesn't work?

But it does work.  Your input string (the one on the left) does
not contain the delimiter string you're passing to the split()
method.  The argument to split() is a delimiter string not a
set of delimter characters.

> The length of the result vector is 1.

Yup :)

-- 
Grant Edwards                   grante             Yow!  This MUST be a good
                                  at               party -- My RIB CAGE is
                               visi.com            being painfully pressed up
                                                   against someone's MARTINI!!



More information about the Python-list mailing list