Perl s/ To Python?

Andreas Kostyrka andreas at kostyrka.org
Fri Jun 10 10:57:35 EDT 2005


I'd consider taking a look at the re module ;)

Andreas

On Fri, Jun 10, 2005 at 02:57:21PM +0100, John Abel wrote:
> 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
> 
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list