Guest User

Untitled

a guest
May 8th, 2012
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  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""")
Advertisement
Add Comment
Please, Sign In to add comment