On 07 Feb 2010, at 10:03, Shashwat Anand wrote:

Here is one simple solution :
>>> intext = """Lorem [ipsum] dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut [labore] et [dolore] magna aliqua."""

>>> intext.replace('[', '{').replace(']', '}')
'Lorem {ipsum} dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut {labore} et {dolore} magna aliqua.'

Some people, when confronted with a problem, think "I know, I’ll use regular expressions." Now they have two problems. — Jamie Zawinski in comp.lang.emacs.

That is because regular expressions are what we learned in programming the shell from sed to awk and ksh and zsh and of course Perl and we've read the two books by Jeffrey and much much more!!!

How do we rethink and relearn how we do things and should we ?

What is the solution ?

Jerry
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to