mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-22 09:42:15 +03:00
A util method that reads a file line by line and returns a list of read lines
This commit is contained in:
parent
5a26988410
commit
252d898360
1 changed files with 9 additions and 0 deletions
|
@ -95,6 +95,15 @@ class Util:
|
|||
finally:
|
||||
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
|
||||
def write_file(full_path, content, mode='w+'):
|
||||
file = None
|
||||
|
|
Loading…
Reference in a new issue