Skip to content

Latest commit

 

History

History
37 lines (29 loc) · 660 Bytes

README.md

File metadata and controls

37 lines (29 loc) · 660 Bytes

pyssh

Python version

  • python连接ssh
  • 运行脚本

ssh连接参数 config.json配置:

  • ssh登录参数保存与读取:
import json

my_dict = {"host": "00.00.00.00","port": 22,"user": "root", "pw": "password"}
# 保存文件
tf = open("config.json", "w")
json.dump(my_dict,tf)
tf.close()
# 读取文件
tf = open("config.json", "r")
new_dict = json.load(tf)
print(new_dict)
  • 直接新建 config.json文件,其样式如下:
{
    "host": "00.00.00.00",
    "port": 22,
    "user": "root",
    "pw": "password"
}