Extracting text from a string
Claudio Grondi
claudio.grondi at freenet.de
Thu Sep 7 16:31:43 EDT 2006
Tempo wrote:
> This is the output I get:
>
>
>
>
>>>>prices
>
> [<span class="sale">
> $14.99
> </span>, <span class="sale">
> $27.99
> </span>, <span class="sale">
> $66.99
> </span>, <span class="sale">
> $129.99
> </span>, <span class="sale">
> $254.99
> </span>]
>
>
I think, guessing your knowledge level in Python, the best solution for
you to start with and learn some Python basics will be :
>>> prices.split()[2]
'$14.99'
>>> prices.split()[6]
'$27.99'
>>> prices.split()[10]
'$66.99'
>>> prices.split()[14]
'$129.99'
>>> prices.split()[18]
'$254.99'
Claudio Grondi
More information about the Python-list
mailing list