Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from time import gmtime, strftime;data = { }
- while True:
- inp = raw_input().split(" ")
- if inp[0] == '*':
- data = { }
- elif len(inp) < 2:
- break
- else:
- if inp[0] == '!':
- del data[inp[1]]
- elif inp[0] == '?':
- if inp[1] in data:
- print data[inp[1]]
- else:
- data[inp[0]] = inp[1]
- def quine(source):
- global data
- f = open('session' + strftime("%Y-%m-%d-%H-%M-%S", gmtime()) + '.py', 'w')
- quote = '"' * 3
- f.write('from time import gmtime, strftime;data = ' + repr(data) + source + '(' + quote + source + quote + ')')
- f.close()
- quine("""
- while True:
- inp = raw_input().split(" ")
- if inp[0] == '*':
- data = { }
- elif len(inp) < 2:
- break
- else:
- if inp[0] == '!':
- del data[inp[1]]
- elif inp[0] == '?':
- if inp[1] in data:
- print data[inp[1]]
- else:
- data[inp[0]] = inp[1]
- def quine(source):
- global data
- f = open('session' + strftime("%Y-%m-%d-%H-%M-%S", gmtime()) + '.py', 'w')
- quote = '"' * 3
- f.write('from time import gmtime, strftime;data = ' + repr(data) + source + '(' + quote + source + quote + ')')
- f.close()
- quine""")
Advertisement
Add Comment
Please, Sign In to add comment