我有一个代码片段,其工作原理:类型错误:不能连接“海峡”和“名单”对象
p = subprocess.Popen('psftp servername'.split(),stdin=subprocess.PIPE, tdout=subprocess.PIPE, shell=True)
p.stdin.write('lcd P:\\ORACLE_UNIX\\Development\n')
p.stdin.write('get //opt//jboss//current//server//default//conf//DMS.properties\n')
p.stdin.write('bye\n')
p.stdout.close()
p.stdin.close()
但是,当我有一个变量集(我会参考其他地区的服务器) :
devserv='servername'
p = subprocess.Popen('psftp' +devserv.split(),stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True)
p.stdin.write('lcd P:\\ORACLE_UNIX\\Development\n')
p.stdin.write('get //opt//jboss//current//server//default//conf//DMS.properties\n')
p.stdin.write('bye\n')
p.stdout.close()
p.stdin.close()
...我总是得到类型错误:不能连接 '海峡' 和 '名单' 对象。为什么?
这已经解决了我的问题,非常感谢您的帮助 – geekcomputers