[issue23884] New DateType for argparse (like FileType but for dates)

paul j3 report at bugs.python.org
Wed Apr 8 00:57:34 CEST 2015


paul j3 added the comment:

Examples of datetime types from Stackoverflow:

http://stackoverflow.com/questions/21437258/defining-python-argparse-arguments
The suggested answer (but not accepted) is 'type=lambda s: datetime.datetime.strptime(s, '%Y-%m-%d')'

another
http://stackoverflow.com/questions/12462074/python-argparse-create-timedelta-object-from-argument

which references
https://gist.github.com/jnothman/4057689
'timedeltatype.py: An argparse type factory that produces datetime.timedelta objects'

and
http://stackoverflow.com/questions/25470844/specify-format-for-input-arguments-argparse-python
with a type function

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23884>
_______________________________________


More information about the Python-bugs-list mailing list