What is the most pythonic way to insert a variable number of arguments into a string?
For example:
Given a variable date format that may be of the form: YYYY-MM-DD,YYYY-MM-DD HH,YYYY-MM-DD HH:MM or YYYY-MM-DD HH:MM:SS.
I would like to insert the values for year, month, day, hour, minute, second into a string, similar to a statement like this:
"%d/%d/%d %d:%d:%d" % (variable number of arguments here)
Such that a print statement of the above string would output a date which, where possible, the actual values are inserted, and if they are not available, a default value of 0 is inserted.
Please note I am not looking for a solution to this particular example, I am looking for a solution to the more general question I state at the beginning (which should work for the example provided). I'm also looking for a solution that doesn't involve an if...elif...else block.