diff python/utils.py @ 969:5d788d2e8ffc

work in progress
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Thu, 07 Dec 2017 17:03:09 -0500
parents d8ab183a7351
children 9897a13772fb
line wrap: on
line diff
--- a/python/utils.py	Thu Dec 07 15:13:06 2017 -0500
+++ b/python/utils.py	Thu Dec 07 17:03:09 2017 -0500
@@ -13,6 +13,8 @@
 
 datetimeFormat = "%Y-%m-%d %H:%M:%S"
 
+sjcamDatetimeFormat = "%Y_%m%d_%H%M%S"#2017_0626_143720
+
 #########################
 # Strings
 #########################
@@ -939,6 +941,14 @@
     else:
         return filename
 
+def getExtension(filename, delimiter = '.'):
+    '''Returns the filename minus the extension (all characters after last .)'''
+    i = filename.rfind(delimiter)
+    if i>0:
+        return filename[i+1:]
+    else:
+        return ''
+
 def cleanFilename(s):
     'cleans filenames obtained when contatenating figure characteristics'
     return s.replace(' ','-').replace('.','').replace('/','-').replace(',','')