Schif Schaf <[email protected]> writes: > (brackets replaced by braces). I can do that with Perl pretty easily: > > ~~~~ > for (<>) { > s/\[(.+?)\]/\{$1\}/g; > print; > } > ~~~~
Just curious, but since this is just transpose, then why not simply
tr/[]/{}/? I.e. why use a regular expression at all for this?
In python you would do this with
for line in text:
print line.replace('[', '{').replace(']', '}')
--
http://mail.python.org/mailman/listinfo/python-list
