read a files particular line

Kristóf Stróbl kristof at rubin.hu
Thu Oct 14 11:42:03 CEST 2004


Hi,

If the file is not too big use:

file("filename").readlines()[11]

Kristóf

Frank Grellert wrote:

> Hi,
> does anybody have an idea how to read a particular line of a file like awk's
> awk '{if( NR==12) print $0}' filename (reads lineno 12 of filename)
> 
> thanks for your help
> 
> Frank Grellert




More information about the Python-list mailing list