From: Stephen Soltesz Date: Fri, 8 Aug 2008 18:02:12 +0000 (+0000) Subject: file operations for reading and writing lists of nodes/sites/pcus, etc. X-Git-Tag: Monitor-1.0-6~9 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=290ede36585722a228044acd15a6e8e7991db973;hp=c3f2afdc81c6711c3825c82e2cd4970671575438;p=monitor.git file operations for reading and writing lists of nodes/sites/pcus, etc. --- diff --git a/util/file.py b/util/file.py new file mode 100644 index 0000000..167186a --- /dev/null +++ b/util/file.py @@ -0,0 +1,19 @@ +#!/usr/bin/python +import os +import sys + +def setFileFromList(file, list): + f = open(file, 'w') + for line in list: + f.write(line + "\n") + f.close() + return True + +def getListFromFile(file): + f = open(file, 'r') + list = [] + for line in f: + line = line.strip() + list += [line] + return list +