perl to python

Daniel 'Dang' Griffith noemail at noemail4u.com
Tue May 11 07:38:00 EDT 2004


On Tue, 11 May 2004 11:16:01 +0200, Josef Meile <jmeile at hotmail.com>
wrote:

>Steven Rumbalski wrote:
>> Olivier Scalbert wrote:
>> 
>> 
>>>Jarek Zgoda wrote:
>>>
>>>
>>>>Olivier Scalbert <olivier.scalbert at algosyn.com> pisze:
>>>>
>>>>
>>>>>What is the python way of doing this :
>>>>>perl -pi -e 's/string1/string2/' file
>>>>>
>>>>
>>>>Use sed.
>>>>
>>>
>>>yes, but in python ?
>> 
>> 
>> print 'Use sed.'
>Yes, but you're assuming that the users are using Unix/linux. What's 
>about the windows users? Perhaps there is a sed for windows already, but 
>why to bother installing it?
There's definitely a sed available, possibly even in MingW (I have it
on my system, but am not sure if it arrived with MingW or something
else I installed).  It's definitely available with cygwin.  One reason
to install it is that it's smaller than perl or python; another is
that it probably performs the task faster, since it isn't a general
purpose state machine; another is that it's 25% shorter to type than
perl and 50% shorter to type than python.
    --dang



More information about the Python-list mailing list