Nicer way of strip and replace?

Kent Johnson kent37 at tds.net
Tue Oct 11 22:08:58 EDT 2005


Markus Rosenstihl wrote:
> Hi,
> I wonder if i can make this  nicer:
> 
>     euro=euro + float(string.replace(string.strip(rechnung[element][10], 
> '"'), ',' , '.'))

You can use the str methods instead of functions from the string module:
euro=euro + float(rechnung[element][10].strip('"').replace(',' , '.'))

Kent



More information about the Python-list mailing list