[Tutor] Modifying files in a directory.

Kent Johnson kent37 at tds.net
Fri May 30 13:09:35 CEST 2008


On Fri, May 30, 2008 at 4:28 AM, qsqgeekyogdty at tiscali.co.uk
<qsqgeekyogdty at tiscali.co.uk> wrote:

> then, i thought I would loop through this list:
>
>>>> for x in otp:
> ...     print x
> ...
> <td class="order_tbl_price"><span class="order_table_price_small"
>>From</span>$23.60</td>
> <td class="order_tbl_price">$79.99</td>
> <td class="order_tbl_price">$39.99</td>
> <td class="order_tbl_price"><span class="order_table_price"><span
> class="order_table_price_small">1 Blister Pack  - </span> $65.95
>                </span></td>
>>>>
>
> And here I get stuck as to how to modify all the prices?

Just put the modification code inside the loop.

It sounds like you might benefit from working through a basic Python
tutorial, they will all cover loops and files. Many are listed here:
http://wiki.python.org/moin/BeginnersGuide/NonProgrammers

Kent


More information about the Tutor mailing list