Quantcast
Channel: Python datetime timestamp issue - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Python datetime timestamp issue

$
0
0

I was trying to create a dictionary with time stamp as the key.the code is :

>>> stamp = datetime.datetime(2012, 4, 12, 12, 26, int('13'))>>> new_dict = {}>>> new_dict[stamp] = 'one'>>> print new_dict    {datetime.datetime(2012, 4, 12, 12, 26, 13): 'one'}>>> print stamp    2012-04-12 12:26:13

Why does it not take the key as '2012-04-12 12:26:13' and instead taking the expression 'datetime.datetime()' as the key?


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles



Latest Images