On Sun, Dec 14, 2014 at 6:49 AM, 水静流深 <1248283...@qq.com> wrote:
> Is there more elegant way to do the same work?

Unlikely. You have two fairly simple bits of code in your example, one
to connect to the remote server, the other to check for the file's
existence and remove it. The only extra elegance I see is to isolate
those two bits of work into separate functions, so you execute
something like:

sftp = connect_via_paramiko("vps ip", 22)
remove_remote_file(sftp, "/home/names.txt")

Presumably, if you have other work to do on the server, you'd save the
sftp object for reuse.

Skip
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to