[Tutor] Using Python and Regex

Joel Goldstick joel.goldstick at gmail.com
Sun Aug 10 17:58:09 CEST 2014


On Sun, Aug 10, 2014 at 7:30 AM, Bill <bill5work at outlook.com> wrote:
>
> Hi,
>
> I'm relatively new to Python and I'm trying to write a script to iterate
> through a series of text files in folder searching for some specific text
> and write it to a CSV.
>
> I plan to use Regex to match the text and I have already identified the
> Regex to do this. I've also got as far as creating a CSV using python but,
> being new to this, I'm looking for some pointers on how to traverse through
> the folder and open each file in turn to check the content for matches using
> Regex.
>

You need to look at os.walk: https://docs.python.org/2/library/os.html#os.walk

> Any advice would be gratefully received.
>
> Regards
>
> Bill
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor



-- 
Joel Goldstick
http://joelgoldstick.com


More information about the Tutor mailing list