def processDateStamp(sourceStamp):
    date = datetime.strptime(sourceStamp.replace(' ', ''), '%M/%d/%y')
return '{}/{}/{}'.format(date.month, date.day, date.year)
if __name__ == '__main__':
    print(processDateStamp('1/13/17'))
print(processDateStamp(' 1/13/17'))
print(processDateStamp(' 1 /13 /17'))
How to trim spaces within timestamps using 'm/d/yy' format