A util method that reads a file line by line and returns a list of read lines

This commit is contained in:
canerfyz 2016-09-07 10:00:39 +03:00
parent 5a26988410
commit 252d898360

View file

@ -95,6 +95,15 @@ class Util:
finally: finally:
return content return content
@staticmethod
def read_file_by_line(full_path, mode='r'):
line_list = list()
with open(full_path, mode) as f:
lines = f.readlines()
for line in lines:
line_list.append(line)
return line_list
@staticmethod @staticmethod
def write_file(full_path, content, mode='w+'): def write_file(full_path, content, mode='w+'):
file = None file = None