0 length field in time string
Rodrick Brown
rodrick.brown at gmail.com
Tue Aug 17 19:49:28 EDT 2010
Anyone know why I'm getting the following error when trying to parse the following string is there a better method to use?
#57=2010081708240065 - sample string passed to fmt_datetime
def fmt_datetime(tag57):
tag57 = tag57[3:len(tag57)]
year = int ( tag57[0:4] )
mon = int ( tag57[4:6] )
day = int ( tag57[6:8])
hour = int ( tag57[8:10] )
min = int ( tag57[10:12] )
sec = int ( tag57[12:14] )
msec = int ( tag57[14:16] )
dt = datetime.datetime(year,mon,day,hour,min,sec)
return '{:%Y-%m-%d %H:%M:%S}'.format(dt)
File "./delta_delay.py", line 27, in fmt_datetime
return '{:%Y-%m-%d %H:%M:%S}'.format(dt)
ValueError: zero length field name in format
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100817/d995a19a/attachment.html>
More information about the Python-list
mailing list