Mercurial > repos > guerler > springsuite
diff spring_package/DBKit.py @ 37:0be0af9e695d draft
"planemo upload commit c716195a2cc1ed30ff8c4936621091296a93b2fc"
author | guerler |
---|---|
date | Wed, 25 Nov 2020 14:35:35 +0000 |
parents | |
children | 172398348efd |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spring_package/DBKit.py Wed Nov 25 14:35:35 2020 +0000 @@ -0,0 +1,20 @@ +def createFile(identifier, databaseIndex, database, outputName): + start = -1 + size = 0 + with open(databaseIndex) as file: + for line in file: + cols = line.split() + if identifier == cols[0]: + start = int(cols[1]) + size = int(cols[2]) + break + if start != -1 and size > 0: + with open(database) as file: + file.seek(start) + content = file.read(size) + outputFile = open(outputName, "w") + outputFile.write(content) + outputFile.close() + return True + else: + return False