From 5226082616b0f1cbefd08428bb8f6c91f619b26e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Sat, 28 Mar 2020 13:00:17 +0100 Subject: [PATCH] Simplify fileName building --- tools/lib/data.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/lib/data.py b/tools/lib/data.py index 0ee972d1..ab9be2f1 100644 --- a/tools/lib/data.py +++ b/tools/lib/data.py @@ -185,7 +185,10 @@ class dataFileBase(object): subpath=datadir/self.GetFileType().name.lower() if not subpath.exists(): subpath.mkdir() - fileName="{}_{}.dat".format(self.molecule.lower().replace(" ","_"),self.method.name) if self.method.basis==None else "{}_{}_{}.dat".format(self.molecule.lower().replace(" ","_"),self.method.name,self.method.basis) + fileNameComp=[self.molecule.lower().replace(" ","_"),self.method.name] + if self.method.basis: + fileNameComp.append(self.method.basis) + fileName="_".join(fileNameComp)+".dat" file=subpath/fileName if not file.exists(): with file.open("w") as f: