title: need help sending command to server by ssh python
body: <p>I am trying to connect to the server via ssh and dump the "df- h" output in some text file.</p>
  
  <pre><code>p=pexpect.spawn('ssh some.some.com')
  
  i=p.expect([ssh_newkey,'password:',pexpect.EOF])
  if i==0:
      print "I say yes"
      p.sendline('yes')
      i=p.expect([ssh_newkey,'password:',pexpect.EOF])
  if i==1:
      p.sendline("somesome")
      p.expect(pexpect.EOF)
      i = p.sendline('df -h &gt; /home/test/output.txt')
      print i
      response = p.before
      print response
  
  print p.before
  </code></pre>
  
  <p>I am trying to connect to the server and dump the server data in some text file.
  My problem is i = p.sendline('df -h > /home/test/output.txt') is not doing anything,
  Basically my output file is empty.
  Please help me out.</p>
  
  <p>Thanks.</p>