file rewind?

Emile van Sebille emile at fenx.com
Fri Apr 5 09:49:18 EST 2002


joel8bit> I have this code:
>
> def countLines(file):
[snip]

While you're probably experimenting with various things, for files that
fit in available memory the specific results you're going for here can
be got at using:

def test(name):
    lines = len(open(name).readlines())
    chars = len(open(name).read())

or, depending on what you're after, using open(name, 'rb').

--

Emile van Sebille
emile at fenx.com

---------




More information about the Python-list mailing list