python paramiko SFTP文档地址: http://docs.paramiko.org/en/2.4/api/sftp.html
import paramiko

host = "THEHOST.com"                    #hard-coded
port = 22
transport = paramiko.Transport((host, port))

password = "THEPASSWORD"                #hard-coded
username = "THEUSERNAME"                #hard-coded
transport.connect(username = username, password = password)

sftp = paramiko.SFTPClient.from_transport(transport)

import sys
path = './THETARGETDIRECTORY/' + sys.argv[1]    #hard-coded
localpath = sys.argv[1]
sftp.put(localpath, path)

sftp.close()
transport.close()
print 'Upload done.'

python 执行cmd命令并获取pid

    process = subprocess.Popen('cmd命令')     pid = process.pid     print(pid)

阅读全文

适用于python 3+ pymsql 扩展类

适用于python 3+ pymsql 扩展类,包含增删改查 首先要安装pymsql , pip install pymsql #!/usr/bin/env python # -*- coding: utf-8 -*- import pymysql imp...

阅读全文

pycharm最新激活方法 2016.2

pycharm最新激活方法 2016.2 。 有2种方法,第一种激活方法不行就试试第二种。 1.选License server激活,输入:http://114.215.133.70:41017/ 2.选择第二种激...

阅读全文

欢迎留言