From f67a6be8ec173e997ab71c7b94c956cd854d82b8 Mon Sep 17 00:00:00 2001 From: Mohcine Chraibi <m.chraibi@fz-juelich.de> Date: Fri, 10 Mar 2017 15:01:59 +0100 Subject: [PATCH] modify file name --- scripts/xml2txt.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/xml2txt.py b/scripts/xml2txt.py index e9836201..b6f996f5 100644 --- a/scripts/xml2txt.py +++ b/scripts/xml2txt.py @@ -30,10 +30,11 @@ if __name__ == "__main__": exit('usage: %s filename' % argv[0]) filename = argv[1] - dirname = os.path.dirname(filename) - basename = os.path.basename(filename) - basename = basename.split(".")[0] + ".txt" - output = os.path.join(dirname, basename) + filename1, file_extension = os.path.splitext(filename) + if file_extension != ".xml": + exit('not an xml file') + + output = filename1 + ".txt" o = open(output, "w") # o.write("# ID frame x y z\n\n") print (">> %s" % output) -- GitLab