Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 12th, 2004, 11:08 AM
pythonboy pythonboy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 3 pythonboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Post #3

If I run it like this... I still get an error.. How do I define time??

This is the error I get... Traceback (most recent call last):
File "C:\Documents and Settings\Alex\Desktop\Module1CASE.py", line 19, in ?
t = time.localtime(time.time())
NameError: name 'time' is not defined

here it is ....

print "Petty Cash Account Balance"
class Account:
def __init__(self, initial):
self.balance = initial
def deposit (self, amt):
self.balance = self.balance + amt
def withdraw(self,amt):
self.balance = self.balance - amt
def getbalance(self):
return self.balance

a = Account(500000.00)
a.deposit(550.23)
a.deposit(5000.50)
a.deposit(100)
a.withdraw(50)
print a.getbalance()

t = time.localtime(time.time())
st = time.strftime(" %d-%b-%Y %H:%M:%S", t)

print t.time()

Reply With Quote
  #2  
Old July 12th, 2004, 11:17 AM
Naddel Naddel is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: Germany
Posts: 11 Naddel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 17 m 25 sec
Reputation Power: 0
hi
don't forget to use the code tags next time

you must import the time module like this:
Code:
import time

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Post #3


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT