- 博客(5)
- 收藏
- 关注
原创 少儿Python编程(一)——润年计算
一、功能 计算润年 二、实现 a = input("Please input the year: ") if a % 4: print ("The yaar %s is not a leap year" % a) else: if a % 100 : print ("The year %s is a leap year" % a) elif a % 400: print ("The year %s is not a leap year" % a)
2020-10-29 08:37:42
323
原创 Docker实践(一)——给不同的容器分配IP地址
一、功能 docker给不同的容器分配IP地址 二、实现 `docker network create --subnet=172.18.0.0/16 mynetwork docker run -itd --name test1 -P --net mynetwork --ip 172.18.0.2 centos:latest /bin/bash docker run -itd --name python -P --net mynetwork --ip 172.18.0.3 python:3.5 /bin/
2020-10-29 08:32:02
1595
原创 Python实践(三)——发送HTTPS消息
一、功能 发送HTTPS消息 二、实现 import ssl import httplib2 import json def getdigest(d,bufsize=1024*5,type='md5'): import hashlib try: m = hashlib.md5() m.update(d) return m.hexdigest() except: return '' passwd = '111111
2020-10-27 12:49:29
713
原创 Python实践(二)——通过SSHTunnel远程访问数据库
一、功能 访问数据库 数据库需要远程通过SSHTunnel访问 二、实现 import pymysql from sshtunnel import SSHTunnelForwarder sshServerB_ip = '192.168.3.126' sshServerB_port = 22 sshServerB_usr = 'root' sshServerB_pwd = 'root' databaseA_ip = 'localhost' databaseA_port = 3306 databaseA_
2020-10-27 12:45:37
336
2
原创 Python实践(一)——paramiko监控日志
# Python实践(一)_paramiko监控日志一、功能二、实现 一、功能 使用paramiko打开ssh连接远程服务器 tail命令监控服务器上某日志文件 日志文件中出现期望的文字,停止日志文件监控 执行相关命令 二、实现 代码如下(示例): import sys import traceback import paramiko import time from paramiko_expect import SSHClientInteraction etx = '\x03' host = "1
2020-10-27 11:41:31
1661
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅