Reading from text

JB zorro at chez.Com
Tue Feb 17 18:12:07 CET 2009


oamram a écrit :
> Hi All,
> new to python. i have a directory with about 50 text file and i need to
> iterate through them and get
> line 7 to 11 from each file and write those lines into another file(one file
> that will contain all lines).

First create a function that read and parse one file

Then create a loop that call this function for each file in a directory

Modules to read :

http://www.python.org/doc/2.5.2/tut/node9.html#SECTION009210000000000000000
http://docs.python.org/library/os.html


Julien



More information about the Python-list mailing list