Created
April 6, 2018 17:50
-
-
Save zgrge/57db5d7c2b91c444cf42681f9926a8f8 to your computer and use it in GitHub Desktop.
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
record = b'raymond \x32\x12\x08\x01\x08\x0c\x07\x1b\r\x03\x04' | |
name, serialnum, school, gradelevel, Y, m, d, H, M, S = struct.unpack('<10sHHb6b', record) | |
from collections import namedtuple | |
#Can i instantly get Datetime object from unpack below? | |
Student = namedtuple('Student', 'name serialnum school gradelevel Y m d H M S') | |
Student._make(struct.unpack('<10sHHb6b', record)) | |
dt = datetime(Y, m, d, H, M, S) | |
print(dt.strftime('%Y-%m-%d %H:%M:%S')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment