Perl s/ To Python?

John Abel jabel at plus.net
Fri Jun 10 09:57:21 EDT 2005


Does anyone know of a quick way of performing this:

$testVar =~ s#/mail/.*$##g

The only way I can think of doing it, is:

mailPos = testVar.find( "mail" )
remainder =  testVar[ :mailPos ]

Any ideas would be appreciated.  I'm iterating over a lot of entries, 
and running these lines for each entry.

J





More information about the Python-list mailing list