[Tutor] Difficulties with % operator

D-Man dsh8290@rit.edu
Thu, 24 May 2001 17:49:21 -0400


On Thu, May 24, 2001 at 04:45:39PM -0700, kromag@nsacom.net wrote:
| D-Man <dsh8290@rit.edu> said: 
| 
| > What you mean instead is to have a 2-tuple containing the result of
| > each function :
| >  ( time.time() , random.randint(1, 1000) )
| > 
| > So the line should read :
| > 
| >  	db.Execute("insert into food values(%d, %i, 'goat', 'pig', 'cow')" % 
| >  ( time.time() , random.randint(1, 1000) ) )
| 
| TUPLE! TUPLE! Now I get it! I was thinking about replacing things and moving 
| parentheses and forgetting chapter 2 altogether! Now If I could just figure 
| out how to properly slow the loop so it won't overload access and lock my 
| little script....

import time
while <...> :
    <...>
    # give Access 10 minutes to get with the program ;-)
    time.sleep( 10 * 60 )


Python is even better than Java -- sleep works properly and doesn't
throw exceptions!

-D