oamram: > 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).
Files can be iterated line-by-line, so this idiom: for line in file: ... will give you the lines, with newline. Once you have debugged that, you can use the standard module glob (http://docs.python.org/library/ glob.html#module-glob ) to iterate on files. If you have more problems, show use the code you have written and we may suggest improvements. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list