[Tutor] FW: Module 1 question
Lloyd Kvam
pythonTutor at venix.com
Thu Jun 17 11:55:45 EDT 2004
The error message says that strtime is NOT FOUND in the time module.
If you run pyton, import time and type dir(time), you will notice that
time contains strftime. You can print out its docstring and get a brief
description. I've pasted the commands and results below.
$ python
Python 2.3.3 (#1, Jan 29 2004, 12:42:14)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import time
>>> dir(time)
['__doc__', '__file__', '__name__', 'accept2dyear', 'altzone',
'asctime', 'clock', 'ctime', 'daylight', 'gmtime', 'localtime',
'mktime', 'sleep', 'strftime', 'strptime', 'struct_time', 'time',
'timezone', 'tzname', 'tzset']
>>> print time.strftime.__doc__
strftime(format[, tuple]) -> string
Convert a time tuple to a string according to a format specification.
See the library reference manual for formatting codes. When the time
tuple
is not present, current time as returned by localtime() is used.
>>>
In other words, you mistyped the name of the function.
On Wed, 2004-06-16 at 16:22, christopher lavezza wrote:
> Can anyone help us out with this problem in our script?
>
>
> >From: Chad Varner <renravdesigns at sbcglobal.net>
> >To: clavezza at hotmail.com
> >Subject: Module 1 question
> >Date: Tue, 15 Jun 2004 20:47:29 -0500
> >
> >Chris,
> >
> > Did you get an answer from your professor on what he is looking for on
> >these modules?
> >
> >Also, I've tried running our code and it keeps giving me the following
> >error:
> >
> >Traceback (most recent call last):
> > File "Script5_1.py", line 23, in ?
> > a.deposit(550.23)
> > File "Script5_1.py", line 8, in deposit
> > t=time.strtime('%a, %d %b %Y %H:%M:%S' , time.localtime(time.time()
> >+ 0))
> >AttributeError: 'module' object has no attribute 'strtime'
> >
> >Could you pass the error on to that guy you know in Colorado,and see if
> >he can explain what the @#$# is wrong exactly?
> >
> >Thanks,
> >--
> >Chad Varner <renravdesigns at sbcglobal.net>
> >
>
> _________________________________________________________________
> Get fast, reliable Internet access with MSN 9 Dial-up now 3 months FREE!
> http://join.msn.click-url.com/go/onm00200361ave/direct/01/
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
--
Lloyd Kvam
Venix Corp.
1 Court Street, Suite 378
Lebanon, NH 03766-1358
voice: 603-653-8139
fax: 801-459-9582
More information about the Tutor
mailing list