Last active
March 26, 2018 02:56
-
-
Save prateekiiest/59fe05f0614ff37ccc374b7f31d6ad9e to your computer and use it in GitHub Desktop.
Enhancement for Handling Tuple
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 parse_time(time, time_format='', **kwargs): | |
# for example time = (2018,10,3,10,43,5,6) | |
if isinstance(time_string, tuple): | |
dat = (''.join("{}-" for i in range(len(time[0:3])))).rstrip('-') | |
tim = (''.join("{}:" for i in range(len(time[3:6])))).rstrip(':') | |
mill_sec = (''.join(".{}" for i in range(len(time[6:])))).rstrip(':') | |
return T.Time((dat + " " + tim + mill_sec).format(*time)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment