On Thu, Oct 23, 2008 at 11:54 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello everyone, > I would like to know what isn't good in my script. > #!/usr/bin/python > # -*- coding: iso-8859-15 -*- > from time import strftime > import datetime > t = input(datetime.date)
input() does not do what you think it does. You want raw_input(). raw_input() takes a string to prompt the user with and returns the string the user enters. You'll then pass the string to time.strptime() (along with a format string) to parse it into a time tuple. You'll then pass part of the time tuple to the datetime.date() constructor to get a date object. > global t 'global' declarations are only allowed (and only make sense) inside a function. Remove the above line. Based on some of the errors you've made, I'd recommend reading through Python's fine tutorial before going any further: http://docs.python.org/tutorial/index.html Cheers, Chris -- Follow the path of the Iguana... http://rebertia.com > 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.") > raw_input() > 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 > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list