readln() until EOF

Stephen Johnson diordna at gmail.com
Thu Jul 24 21:12:36 CEST 2008


the_file = open(path, 'r')
for this_line in the_file:
	#do stuff with this_line

-Steve Johnson

On Jul 24, 2008, at 3:09 PM, korean_dave wrote:

> a = open("Thefile.txt","r")
>
> while ?????:
>  result = a.readln()
>
> what do i put in ???? if i want to keep reading line by line until i
> reach the end of the file?
>
> I don't want to break the loop if there is a blank line, because there
> will be.
>
> Ex. of a file:
>
> map1
> result1
>
> map2
> result 2
>
> map3
> result3
> comments
>
> thanks...
> --
> http://mail.python.org/mailman/listinfo/python-list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080724/53961b9b/attachment.html>


More information about the Python-list mailing list