[Tutor] help with re.split use

Michel Bélanger michel.belanger at seidel.ca
Thu Jan 29 10:59:43 EST 2004


Daniel Ehrenberg wrote:

Don't use re.split(' ', somestring), use
' '.split(somestring). That fixes your problem. Only
use the re module when you're not just matching a
string.


Here is the code I tried:

# -*- coding: cp1252 -*-
row = "Genevieve Camirée"
contact = ' '.split(row)
print row, contact

I get an empty string:

Genevieve Camirée [' ']







More information about the Tutor mailing list