summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-07-18 17:09:38 +0800
committerPeng Wu <alexepico@gmail.com>2011-07-18 17:09:38 +0800
commitc60c7a70e1af20ee46f57817137df980b6392133 (patch)
tree21d8798113fd13db4979944afa031d344be6dfb5 /lib
parent073f8d930c94a2209ddab12f2cd44f4ae05bbffd (diff)
downloadtrainer-c60c7a70e1af20ee46f57817137df980b6392133.tar.gz
trainer-c60c7a70e1af20ee46f57817137df980b6392133.tar.xz
trainer-c60c7a70e1af20ee46f57817137df980b6392133.zip
clean up zero length segment report
Diffstat (limited to 'lib')
-rw-r--r--lib/utils.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/utils.py b/lib/utils.py
index 447637a..d876d67 100644
--- a/lib/utils.py
+++ b/lib/utils.py
@@ -14,7 +14,7 @@ class EpochError(Exception):
#Utils
-#File Load/Store
+#File Load/Store/Length
def read_file(infile):
with open(infile, 'r') as f:
data = ''.join(f.readlines())
@@ -27,6 +27,13 @@ def write_file(outfile, data):
f.close()
return
+def get_file_length(infile):
+ f = open(infile, 'r')
+ f.seek(0, whence=io.SEEK_END)
+ length = f.tell()
+ f.close()
+ return length
+
#JSON Load/Store
def load_status(infile):
data = '{}'