Brian Jones wrote:

> No need for the 're' module. Even in the case where both can be used
> together, you can still just use string methods:
> 
>>>> s
> '12, 13 14'
>>>> s.replace(',', '').split(' ')
> ['12', '13', '14']

I think to replace "," with " " and then split() without explicit separator 
is slightly more robust. Compare:
 
>>> s = "12,34, 56  789"
>>> s.replace(",", " ").split()
['12', '34', '56', '789']
>>> s.replace(",", "").split(" ")
['1234', '56', '', '789']

Peter

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to