On 07/10/2007, Tim Chase <[EMAIL PROTECTED]> wrote:
> > I'm not really sure how readline() works. Is there a way to iterate
> > through a file with multiple lines and then putting each line in a
> > variable in a loop?
>
> You can use readlines() to get the whole line (including the
> newline):
>
>
On Sun, 07 Oct 2007 12:00:44 +, Vernon Wenberg III wrote:
> I'm not really sure how readline() works. Is there a way to iterate
> through a file with multiple lines and then putting each line in a
> variable in a loop?
There are always more ways how to do it.. one of them is:
f = open(file
> I'm not really sure how readline() works. Is there a way to iterate
> through a file with multiple lines and then putting each line in a
> variable in a loop?
You can use readlines() to get the whole line (including the
newline):
lines = file('x.txt').readlines()
or you can iterate over th
Vernon Wenberg III wrote:
> I'm not really sure how readline() works. Is there a way to iterate
> through a file with multiple lines and then putting each line in a
> variable in a loop?
To know how something works you can always check the docs about this
specific functionality:
>>> a = open('a'