summaryrefslogtreecommitdiffstats
path: root/Lib/robotparser.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/robotparser.py')
-rw-r--r--Lib/robotparser.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/Lib/robotparser.py b/Lib/robotparser.py
index 5b1d797..f249187 100644
--- a/Lib/robotparser.py
+++ b/Lib/robotparser.py
@@ -55,11 +55,8 @@ class RobotFileParser:
"""Reads the robots.txt URL and feeds it to the parser."""
opener = URLopener()
f = opener.open(self.url)
- lines = []
- line = f.readline()
- while line:
- lines.append(line.strip())
- line = f.readline()
+ lines = [line.strip() for line in f]
+ f.close()
self.errcode = opener.errcode
if self.errcode in (401, 403):
self.disallow_all = True
@@ -84,7 +81,7 @@ class RobotFileParser:
entry = Entry()
for line in lines:
- linenumber = linenumber + 1
+ linenumber += 1
if not line:
if state == 1:
entry = Entry()