我正在从终端运行 python 程序
python -i abc.py <test.txt
但在程序完成后,它不会留在 python 中。
我想要的是:
Output:
4 21
>>>
怎么了 -
Output:
4 21
>>> >>>
Downloads:~$
通常,如果我们发出命令
python -i abc.py
,它会在运行程序后进入 python 交互模式。
程序(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)
测试.txt
1
I want to buy Car for $10000
谢谢