Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 1.10 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. from time import gmtime, strftime;data = { }
  2. while True:
  3.   inp = raw_input().split(" ")
  4.   if inp[0] == '*':
  5.     data = { }
  6.   elif len(inp) < 2:
  7.     break
  8.   else:
  9.     if inp[0] == '!':
  10.       del data[inp[1]]
  11.     elif inp[0] == '?':
  12.       if inp[1] in data:
  13.         print data[inp[1]]
  14.     else:
  15.       data[inp[0]] = inp[1]
  16.  
  17. def quine(source):
  18.   global data
  19.   f = open('session' + strftime("%Y-%m-%d-%H-%M-%S", gmtime()) + '.py', 'w')
  20.   quote = '"' * 3
  21.   f.write('from time import gmtime, strftime;data = ' + repr(data) + source + '(' + quote + source + quote + ')')
  22.   f.close()
  23.  
  24. quine("""
  25. while True:
  26.   inp = raw_input().split(" ")
  27.   if inp[0] == '*':
  28.     data = { }
  29.   elif len(inp) < 2:
  30.     break
  31.   else:
  32.     if inp[0] == '!':
  33.       del data[inp[1]]
  34.     elif inp[0] == '?':
  35.       if inp[1] in data:
  36.         print data[inp[1]]
  37.     else:
  38.       data[inp[0]] = inp[1]
  39.  
  40. def quine(source):
  41.   global data
  42.   f = open('session' + strftime("%Y-%m-%d-%H-%M-%S", gmtime()) + '.py', 'w')
  43.   quote = '"' * 3
  44.   f.write('from time import gmtime, strftime;data = ' + repr(data) + source + '(' + quote + source + quote + ')')
  45.   f.close()
  46.  
  47. quine""")