Python Script Bug
benjamin.kaplan at case.edu
Thu Oct 23 21:45:55 CEST 2008
On Thu, Oct 23, 2008 at 2:54 PM, max.caly at gmail.com <max.caly at gmail.com>wrote:
> Hello everyone,
> I would like to know what isn't good in my script.
> # -*- coding: iso-8859-15 -*-
> from time import strftime
> import datetime
> t = input(datetime.date)
> global t
> print t.strftime("Day %w of the week a %A . Day %d of the month (%B).
> print t.strftime("Day %j of the year (%Y), in week %W of the year.")
> i get error :
> print t.strftime("Day %w of the week a %A . Day %d of the month
> (%B). ")
> AttributeError: 'tuple' object has no attribute 'strftime'
> Thanks for your Help
1) why are you using input and raw_input? Are you trying to use them as
2) Do you understand what t.strftime is doing? It is trying to access an
attribute of t (a tuple) called 'strftime'. A tuple does not have an
attribute by that name, so it throws an AttributeError. You probably want
print strftime("Day %w of the week a %A . Day %d of the month (%B).", t)
#this checks globals() for an attribute called strftime
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list