python

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python
import sys
import readline,rlcompleter
readline.parse_and_bind("tab:complete")
while True:
try:
comand=raw_input(">>> ")
if comand=="exit":
print "Use exit() or Ctrl-D (i.e. EOF) to exit"
if comand=="exit()":
sys.exit(0)
if comand.find(":")!=-1:
while True:
s=0
a=raw_input("...\t")
x=""
x=a+x
if a=='':
s=s+1
if s==2:
exec(x)
break
exec(comand)
except KeyboardInterrupt:
print
print "KeyboardInterrupt"
except EOFError:
print
sys.exit(0)
except:
raise