Ich bin mit Python-Programm von TerminalWie im interaktiven Python-Interpreter nach dem Ausführen des Programms bleiben?
python -i abc.py <test.txt
aber nach Abschluss des Programms ist es nicht in Python bleiben.
, was ich will:
Output:
4 21
>>>
Was
Output:
4 21
>>> >>>
Downloads:~$
Normalerweise happening-- ist, wenn wir Befehl python -i abc.py
geht es in Python interaktiven Modus nach dem Ausführen des Programms geben.
Programm (abc.py);
line=[]
f=int(raw_input())
i=0
while(i<f):
m=raw_input()
line.append(m)
i+=1
for i in line:
ind=i.find('$')
temp=''
for j in i[ind+1:]:
t=ord(j)
if((t>=48)&(t<=57)):temp=temp+j
elif(t!=32): break
temp='$'+str(int(temp))
print(temp)
test.txt
1
I want to buy Car for $10000
Dank
Hat der Code eine 'exit()' oder irgendetwas darin? – syntonym
Nein, ich habe auch das Programm und die Testdatei als Referenz hinzugefügt. – hunch