python脚本
努力xxx
这个作者很懒,什么都没留下…
展开
-
利用python3创建数据库表(脚本)
安装模块pip3 install pymysqlpython脚本#!/usr/bin/python3#创建数据库表import pymysql# 创建连接conn = pymysql.connect( host='127.0.0.1', #数据库地址 port=3306, # 数据库端口 user='root', # 连接数据库的用户 passwd='123', # 连接数据库的密码 db='hos原创 2021-03-22 23:02:24 · 643 阅读 · 0 评论 -
利用python3插入多条MySQL语句(python脚本)
下载模块pip3 install pymysqlpython脚本#!/usr/bin/python3#插入多数据#导入模块import pymysqlli = []#创建连接conn = pymysql.connect( host='127.0.0.1', port=3306, user='root', passwd='123456', db='host_info', charset='utf8mb4')# 获取游标cursor =原创 2021-03-22 22:50:34 · 527 阅读 · 0 评论 -
python脚本(切取cpu、切取系统内存、切取系统磁盘、切取系统cpu负载、切取IP地址)
切取cpu#!/user/bin/python3#切取cpu名称def cpu(): import subprocess cpus = subprocess.getoutput("grep 'name' /proc/cpuinfo|uniq -c") cpus = cpus.splitlines() for i in cpus: *_,cpu_name = i.split(':') cpu_num,*_ = i.split()原创 2021-03-15 17:44:06 · 251 阅读 · 0 评论 -
python发送钉钉消息脚本
pip3 install requests1.发送给群内所有人import requestscontent = { "msgtype": "text", "text": {"content": "shark 你好"}, # 这里必须包含之前定义关键字 "at": { # 发送给群里的所有人 "isAtAll": True }}headers = {"Content-Type": "application/json;...原创 2021-03-13 16:57:37 · 608 阅读 · 0 评论 -
python发送邮件脚本
import yagmail# 这个要刚才已经成功开通 SMTP 的邮箱账号email_user = '[email protected]'# 这个必须是客户端授权码,不是登录密码email_pwd = 'deeqajpgdlfdhbai'# 这个可以从邮件服务提供商获取email_host = 'smtp.qq.com'# 邮件正文email_content = """你不是我喜欢的那种人却慢慢变成我喜欢的那个人"""#邮箱附件email_image = "./1.jpg原创 2021-03-13 15:26:12 · 111 阅读 · 0 评论