[Tutor] Modifying files in a directory.

Kent Johnson kent37 at tds.net
Thu May 29 12:25:43 CEST 2008


On Thu, May 29, 2008 at 4:17 AM, qsqgeekyogdty at tiscali.co.uk
<qsqgeekyogdty at tiscali.co.uk> wrote:
> Hi,
> >From my previous post, I have tis so far:
>
> [code]
> import os
> from BeautifulSoup import BeautifulSoup
>
>
> rootdir='/home/david/test'
>
> def upDateTable(line):
>    soup = BeautifulSoup(''.join(file))
>
>
>    return line

Notice you are not using or changing line at all here.

BS will work best for this if you pass it the entire contents of the
file, not a line at a time as you are doing.

To figure out the exact commands you need to give BS, it is very
helpful to experiment on the command line.

Kent


More information about the Tutor mailing list