I am pretty sure that there is a function for this, but I been searching for a while, so decided to simply ask SO instead.
I am writing a Python script that parses and analyzes text messages from an input file. Each line looks like this:
Oct 24, 2014, 19:20 - Lee White: Hello world!
or:
Apr 4, 19:20 - Lee White: Hello world!
If the year in the datetime is not mentioned, it means that the message was sent in the current year.
What I want to do, is parse this string into multiple variables. Ideally, I am looking for a function that takes an input string, a format string, and a couple of variables to store the output in:
foo(input, "MMM DD, YYYY, HH:MM - Sender: Text", &mon, &day, &year, &hour, &minutes, &sender, &text)
Does such a thing exist in Python?