Re: [Numpy-discussion] string replace

2014-04-21 Thread Eelco Hoogendoorn
Indeed this isn't numpy, and I don't see how your collegues opinions have bearing on that issue; but anyway.. There isn't a 'python' way to do this, the best method involves some form of parsing library. Undoubtly there is a one-line regex to do this kind of thing, but regexes are themselves the

[Numpy-discussion] string replace

2014-04-20 Thread Siegfried Gonzi
Hi all I know this is not numpy related but a colleague insists the following is supposed to work. But it doesn't: == line_left = './erfo/restart.ST010.EN0001-EN0090.MMDDhh' enafix = 'ST000.EN0001-EN0092' line_left = line_left.replace('STYYY.EN-EN', enafix) print

Re: [Numpy-discussion] string replace

2014-04-20 Thread Robert Kern
On Sun, Apr 20, 2014 at 4:25 PM, Siegfried Gonzi siegfried.go...@ed.ac.uk wrote: Hi all I know this is not numpy related but a colleague insists the following is supposed to work. But it doesn't: == line_left = './erfo/restart.ST010.EN0001-EN0090.MMDDhh' enafix = 'ST000.EN0001-EN0092'