A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2002-April/023697.html below:

[Python-Dev] Use for enumerate()

[Python-Dev] Use for enumerate() [Python-Dev] Use for enumerate()David Ascher DavidA@ActiveState.com
Fri, 26 Apr 2002 17:24:12 -0700
Patrick K. O'Brien wrote:

>[David Ascher]
>
>>def getline(filename, lineno):
>>    if lineno >= 1:
>>         for i, line in enumerate(open(filename)):
>>            if i == lineno - 1:
>>                return line
>>    return ''
>>
>
>But you broke the "always close the file" rule. Cheater!!! <wink>
>
The file will get closed.  I'm just not guaranteeing when =).









RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4