def bench(desc): start = test_time.clock() desc() stop = test_time.clock() diff = stop-start print '%s has token %s.' % (desc.func_name, str(diff))
# -*- coding: utf8 -*- import t_random import test_time if __name__ == "__main__": chars = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '!', '~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '_', '+', '=', '.', ',', '<', '>', '{', '}', '[', ']'] while 1: ss = t_random.sample(chars, 15) ss = ''.join(ss) begintime = test_time.clock() ii = raw_input(ss + '\n') endtime = test_time.clock() print endtime - begintime if ii == 'quit': break if ss == ii: print 'right' else: print 'wrong'