[Tutor] noobie question,,,error related

Timo timomlists at gmail.com
Mon Jan 31 09:36:47 CET 2011


On 31-01-11 04:27, walter weston wrote:
> I get this error when I try and load the datetime module,
>
> Traceback (most recent call last):
>   File "C:/Python27/TIMED_PROGRAM.py", line 2, in <module>
>     datetime.ctime()
> AttributeError: 'module' object has no attribute 'ctime'
>
>
> why is this?
The error says why this is. The function ctime() isn't in the datetime 
module. You should have a look at the documentation [1] where you can 
see that ctime is a method for the date object [2] or the datetime 
object [3].

Cheers,
Timo


[1] http://docs.python.org/library/datetime.html#module-datetime
[2] http://docs.python.org/library/datetime.html#datetime.date.ctime
[3] http://docs.python.org/library/datetime.html#datetime.datetime.ctime


>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list