import pexpect
child = pexpect.spawn('mysqldump -u root -p ELA highest > /home/teddy/test.sql')
index = child.expect("Enter password:")
print(index)
if (index != 0):
print ("ftp login failed")
child.close(force=True)
else:
print(child.after)
child.sendline('!Wf}6e4d)~=-5}k')#这是我mysql密码
输出:
0
b'Enter password:'
输出看着都对,但就是没有导出的sql文件。
请问该怎么办
结尾加上这个
child.expect(pexpect.EOF)