|
@@ -2,10 +2,9 @@ import json
|
|
from collections import OrderedDict
|
|
from collections import OrderedDict
|
|
|
|
|
|
|
|
|
|
-def load_list(filename, encoding='utf-8', start=0, stop=None, step=1):
|
|
|
|
|
|
+def load_list(filename, encoding='utf-8', start=0, stop=None):
|
|
assert isinstance(start, int) and start >= 0
|
|
assert isinstance(start, int) and start >= 0
|
|
assert (stop is None) or (isinstance(stop, int) and stop > start)
|
|
assert (stop is None) or (isinstance(stop, int) and stop > start)
|
|
- assert isinstance(step, int) and step >= 1
|
|
|
|
|
|
|
|
lines = []
|
|
lines = []
|
|
with open(filename, 'r', encoding=encoding) as f:
|
|
with open(filename, 'r', encoding=encoding) as f:
|
|
@@ -14,8 +13,7 @@ def load_list(filename, encoding='utf-8', start=0, stop=None, step=1):
|
|
for k, line in enumerate(f):
|
|
for k, line in enumerate(f):
|
|
if (stop is not None) and (k + start > stop):
|
|
if (stop is not None) and (k + start > stop):
|
|
break
|
|
break
|
|
- if k % step == 0:
|
|
|
|
- lines.append(line.rstrip())
|
|
|
|
|
|
+ lines.append(line.rstrip('\n'))
|
|
return lines
|
|
return lines
|
|
|
|
|
|
|
|
|