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()
实测可行