[Tutor] Message 'list' object has no attribute 'strptime ?

greg whittier greg at thewhittiers.com
Thu Sep 4 22:20:25 CEST 2008


On Thu, Sep 4, 2008 at 4:05 PM, Wayne Watson
<sierra_mtnview at sbcglobal.net>wrote:

>  Further info. If I put
>     y = time.strptime("11 01 05", "%H %M %S")
> both in the function and in the main body. Only the line above in the
> function produces an error message.
>
> Here's a simple program that creates the problem.
>
> import datetime
>
> def verify_time(in_time):
>     time = in_time.split(":")
>

in_time.split(":") produces a list


>     if len(time) <> 3:
>         print
>         print "Invalid format. Try again. hh:mm:ss, hh is 24 hour time."
>         return False
>     y = time.strptime("11 01 05", "%H %M %S")
>

a list object does not have a strptime method
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080904/bbdaa305/attachment-0001.htm>


More information about the Tutor mailing list