Using OS time

valhalla tireseas at
Fri Jun 20 17:45:16 CEST 2003


I asked this query of the Tutor list and was told that Python probably didn't 
have a solution, and that I should use the OS. I want to cast my question net 
a little further, hence my asking this question here.

The problem:
I am writing a rather simple guessing game (a random number is generated, user 
has to guess the number).
I am wanting to introduce a time-limit on the game-play so that the user has - 
e.g. 60 seconds - within which to guess the correct number otherwise they 

The question:
I was hoping to use something out of the time module but could find no 
function to do that kind of thing. I was pointed in the direction of 
importing my OS (Linux) time. 
1. Would this accomplish what I am wanting to as described above?
2. If so, can someone point me in the direction of some decent docs on how I 
could set this up.

I am positive that there must be a relatively straight forward solution, but 
right now I can't see the wood for the trees and would appreciate a different 
perspective please.


||  Reg. Linux User: 313143 ||
Sign the Petition:

More information about the Python-list mailing list