31 lines
615 B
Python
31 lines
615 B
Python
#
|
|
#
|
|
#
|
|
import time
|
|
import re
|
|
|
|
#
|
|
class Toolbox:
|
|
|
|
#
|
|
@staticmethod
|
|
def getTimestampStr():
|
|
timestr = '000'
|
|
try:
|
|
timestr = time.strftime('%Y-%m-%d_%H%M%S', time.localtime(time.time()))
|
|
except:
|
|
pass
|
|
return timestr
|
|
|
|
#
|
|
@staticmethod
|
|
def parseFilenameIncExt(fqfilepath):
|
|
print("filename=={}".format(fqfilepath))
|
|
#regex = re.escape('([\w-_]+)([.\w-_]*)$)')
|
|
results = re.search(r'([\w_-]+)([.\w_-]*)$', fqfilepath)
|
|
if len(results.group(1)) != 0:
|
|
filename = results.group(1)
|
|
if len(results.group(2)) != 0:
|
|
ext = results.group(2)
|
|
return (filename, ext)
|