String manipulation

2007-04-04 Thread marco . minerva
: line = mwfind_re.sub(mwfind_subst, line) print line It correctly identifies the expressions, but doesn't replace the character in the right way. How can I do what I want? Thanks in advance. -- Marco Minerva, [EMAIL PROTECTED] http://blogs.ugidotnet.org/marcom -- http://mail.python.org/mailman/listinfo/python-list

Re: String manipulation

2007-04-04 Thread marco . minerva
line = mwfind_re.sub(mwfind_subst, line) > >print line > > > It correctly identifies the expressions, but doesn't replace the > > character in the right way. How can I do what I want? > > Use the fact that you can also use a function as a substitution. > > print mwfind_re.sub(lambda match: match.group().replace(' ','_'), > "".join(line.strip() for line in filein)) > > 'as- Nascondi testo tra virgolette - > > - Mostra testo tra virgolette - Hi Alexander! Thank you very much, your code works perfectly! -- Marco Minerva, [EMAIL PROTECTED] http://blogs.ugidotnet.org/marcom -- http://mail.python.org/mailman/listinfo/python-list

Re: String manipulation

2007-04-05 Thread marco . minerva
thing along the lines of > > set_phrase.replace(' ', r'\w+') > > 'as Hi! Thanks again... But where must I insert this instruction? -- Marco Minerva, [EMAIL PROTECTED] http://blogs.ugidotnet.org/marcom -- http://mail.python.org/mailman/listinfo/python-list