Clodoaldo Pinto Neto
clodoaldo.pinto.neto at gmail.com
Thu Jul 23 09:32:17 EDT 2009
2009/7/23 Rakotomandimby Mihamina <mihamina at gulfsat.mg>: > Hi all > let the following simplified code be: > > import re > textarea=for.getfirst('text') > spaces=re.compile('^( )+$') > new_txt=re.sub(spaces, '_', textarea) > > The HTML is a very simple form with a textarea. > The substitution doesnt occur. The '+' signs > in the Url seem to be stripped and replaced by > something not matched as a space; What does this code shows?: [ord(x) for x in unicode(textarea, 'utf8')] Replace utf8 for whatever is the used encoding. The best aproach is to just strip leading and trailing spaces: new_txt = textarea.lstrip(' ').rstrip(' ') Regards, Clodoaldo > > I already tried with something like "\s" in the regexp > but no more luck. Any more tips? > Thank you. > > -- > Architecte Informatique: > Administration Systeme, Recherche & Developpement > + 261 32 11 401 65 > Pensez a l'environnement avant d'imprimer ce message > _______________________________________________ > Mod_python mailing list > Mod_python at modpython.org > http://mailman.modpython.org/mailman/listinfo/mod_python >
|