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/023696.html below:

[Python-Dev] Use for enumerate()

[Python-Dev] Use for enumerate() [Python-Dev] Use for enumerate()Patrick K. O'Brien pobrien@orbtech.com
Fri, 26 Apr 2002 19:19:58 -0500
[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>

---
Patrick K. O'Brien
Orbtech




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