[Tutor] How to compare the first line from multiple files

Michael Langford michael.langford at rowdylabs.com
Thu Jan 31 20:25:19 CET 2008


You should checkout os.listdir()

http://docs.python.org/lib/os-file-dir.html

On Jan 31, 2008 2:19 PM, Sorghum Crow <sorcrow at gmail.com> wrote:
> How to compare the first line from multiple files
>
> Greetings,
>
>  I'm new on the forum and relatively new to Python. I have been tasked
> at work with checking some files for consistency.
>
>  What I need to do is verify that the first lines of a group of text
> files are identical.
>  The files are all in the same directory.
>  I know what the first line should be (or I can take the first line
> from the first file as the reference.)
>
> How would I go about doing this.
>
> Thanks in advance.
>
> Regards,
> Sorghum Crow
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>



-- 
Michael Langford
Phone: 404-386-0495
Consulting: http://www.RowdyLabs.com


More information about the Tutor mailing list