Mar-07-2017, 02:16 AM
Mar-07-2017, 02:22 AM
In that specific format, or in a more standard datetime format (like '2/25/70 10:14pm')? If that specific format, the re module (with int() and some multiplication) would probably be best. Otherwise I would look at the time module.
In either case, try something, and when (if) it doesn't work we will help you fix it.
In either case, try something, and when (if) it doesn't work we will help you fix it.
Mar-24-2017, 04:49 PM
The time module is pretty rad:
>>> import time >>> parsed = time.strptime("DAY 3, 09:00 PM", "DAY %d, %I:%M %p") >>> parsed time.struct_time(tm_year=1900, tm_mon=1, tm_mday=3, tm_hour=21, tm_min=0, tm_sec=0, tm_wday=2, tm_yday=3, tm_isdst=-1)