problem with eval and time

Wincent ronggui.huang at gmail.com
Tue Nov 6 04:32:41 CET 2012


Dear all, I would like to convert tstr to representation of time, but encounter the following error. Is there a simple way to get what I want? Thanks.

>>> import time
>>> tstr = str(time.localtime())
>>> eval(tstr)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 1, in <module>
TypeError: structseq() takes at most 2 arguments (9 given)
>>> sys.version
'2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]'

Wincent


More information about the Python-list mailing list