This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def printdict(inputdict,ix): | |
attr = vars(inputdict[inputdict.keys()[ix]]) | |
print ', '.join("%s: %s" % item for item in attr.items()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def change_filepath_if_exists(filepath): | |
f, ext = os.path.splitext(filepath) | |
if os.path.exists(filepath): | |
if f[f.rfind('_')+1:].isdigit(): | |
oldnum = f[f.rfind('_')+1:] | |
newnum = str(int(oldnum)+1) | |
newf = f[0:-len(oldnum)] + newnum | |
f = newf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
datetime.strftime(datetime.now(),'%Y%m%d %H:%M:%S') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
def xldate_to_datetime(xldate): | |
temp = datetime.datetime(1900, 1, 1) | |
delta = datetime.timedelta(days=xldate) | |
return temp+delta |