best way to replace first word in string?

William Park opengeometry at
Sat Oct 22 07:45:59 CEST 2005

hagai26 at <hagai26 at> wrote:
> I am looking for the best and efficient way to replace the first word
> in a str, like this:
> "aa to become" -> "/aa/ to become"
> I know I can use spilt and than join them
> but I can also use regular expressions
> and I sure there is a lot ways, but I need realy efficient one

I doubt you'll find faster than Sed.

man sed

William Park <opengeometry at>, Toronto, Canada
ThinFlash: Linux thin-client on USB key (flash) drive
BashDiff: Super Bash shell

More information about the Python-list mailing list