Hello Everyone, I am a brand new Python programmer with barely a month of experience under my belt.
Here are my specs: Mac OSX Panther 10.3.9 Jython 2.1 implementation with Hermes BBS python module installed And now the problem... Right now I am having a small problem figuring out how to properly format the "User Last Log-On" date for the new external/door that I am writing for our Hermes BBS. Initially, I was using the following in my user initialization function near the top of the code: user.data.usrUndrLast = time.localtime() "user.data.usrUndrLast" is a user data object that I created to display the last time that a person used the external. As you can see, I an setting the value of the object to "time.localtime()". The problem is that the above code gave me a long string like this: (2006, 8, 19, 23, 39, 15, 5, 231, 0) Well, that obviously was not what I wanted or needed. I don't need seconds, or whatever that is that follows after seconds...And that isn't the format I wanted either. So I scrounged around in the example code for another external I have here, as well as in the hermes.py, (module which contains some of the BBS's proprietary functions), the jython-2.1 folder, (Python implementation I am using with the BBS), and even in my OSX Python installation, and then also on the web, looking for a clue regarding how to get it to do what I want it to do. I figured out that adding [:3] like this: user.data.usrUndrLast = time.localtime()[:3] ...would reduce it to just "(2006, 8, 19)", but that is still not what I want it to do. The format is wrong. I found a lot of interesting stuff inside of "rfc822.py" concerning date and time formats, but I am still not grasping quite how to do this. Right now, I am getting a TypeError, I guess because time.localtime only deals with integers, and I am trying to throw strings at it as well, like this: user.data.usrUndrLast = time.localtime('%a, %d %b %Y') I was hoping that the above code would produce something like this: Sun 20 Aug 2006 ...but what I am getting is a TypeError which states: "TypeError: localtime(): 1st arg can't be coerced to double" So at this point, I am pretty stumped. In the list of players, I just want it to show when they were last logged into the external, preferably in one of the following formats: Sun 20 Aug 2006 Sun Aug 20 2006 Aug 20 2006 08-20-06 08-20-2006 08/20/2006 08/20/06 Once the above code, (user.data.usrUndrLast = time.localtime), initializes their last log-on date, I am using the results in a user list by appending the data to the user list like this: for u in external.users.values(): usrList.append({ 'name': u.data.usrUndrName, 'levl': u.data.usrUndrLevl, 'scor': u.data.usrUndrScor, 'last': u.data.usrUndrLast, # The one we're dealing with }) The above list code queries the external for the values that it has stored for each user. When it gets to the "last" item in the list, the external is supposed to send it the value for "u.data.usrUndrLast", (which it does), which is filled in with the value of "time.localtime()" Once the list is made, the "last" code will be displayed in the user list using this piece of code: print Style(fgLtGreen)('%(last)-10s' % markUsr) For the record, I do have "import time" at the top of my code. I looked all over the place for a module called "time.py", but couldn't find one. So I didn't quite understand where "time.py" was being imported from. I finally figured that it must just be a function which is being imported from one of the jython modules that I was looking at...although I never found an exact function called "time()" or "time.localtime(). So if anyone can lend me a hand with this, I'd really appreciate it. I am really working hard, and doing the best I can to learn Python, (my very first programming language), but I still require some guidance. If anyone here can tell me how to get the results that I want, I would really appreciate if you would write to me directly at: [EMAIL PROTECTED] Thanks so much. -- http://mail.python.org/mailman/listinfo/python-list