发布时间:2019-09-18 07:24:51编辑:auto阅读(1912)
import os
from subprocess import Popen,PIPE
sqlplus = Popen(["sqlplus", "-S", "andy/root"], stdout=PIPE, stdin=PIPE)
sqlplus.stdin.write("select sysdate from dual;"+os.linesep)
sqlplus.stdin.write("insert into t_python values(1,'chenlong');"+os.linesep)
sqlplus.stdin.write("insert into t_python values(2,'xiao');"+os.linesep)
sqlplus.stdin.write("select count(*) from t_python;"+os.linesep)
sqlplus0.stdin.write("select count(*) from emp;"+os.linesep)
out, err = sqlplus.communicate()
print out
sqlplus0 = Popen(["sqlplus", "-S", "scott/root"], stdout=PIPE, stdin=PIPE)
out0, err0 = sqlplus0.communicate()
print out0
上一篇: Python -- str 类
下一篇: python版wc
51559
51132
41657
38413
32901
29875
28593
23553
23484
21831
1981°
2685°
2248°
2177°
2627°
2193°
2943°
4872°
4700°
3348°