python 自动脚本传输远程文件window ubuntu

import math

def angle_between_vectors(vector_a, vector_b):
    dot_product = sum(x * y for x, y in zip(vector_a, vector_b))
    magnitude_a = math.sqrt(sum(x ** 2 for x in vector_a))
    magnitude_b = math.sqrt(sum(y ** 2 for y in vector_b))
    cosine_theta = dot_product / (magnitude_a * magnitude_b)
    theta = math.acos(cosine_theta)
    return math.degrees(theta)

# 示例向量
vector1 = [1, 2, 3]
vector2 = [4, 5, 6]

angle = angle_between_vectors(vector1, vector2)
print(f"The angle between the vectors is {angle} degrees.")
import paramiko

hostnames = [
        # "192.168.0.101" 
        "192.168.0.102" 
        , "192.168.0.103" 
        # , "192.168.0.104" 
        # ,"192.168.0.105" 
        # ,"192.168.0.106" 
        ]
name = 'wheeltec' 
pwd = 'dongguan' 

for h in hostnames:
    sf=paramiko.Transport(h,22)
    sf.connect(username = name,password=pwd )
    sftp1 = paramiko.SFTPClient.from_transport(sf)
    sftp1.put(r'C:\Users\a.py','/home/a.py')
    sftp1.close()
    sf.close()

实测可行

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值