![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
SakuraGaara
21
展开
-
Python连接mysql【pymysql】
#!/usr/bin/env python# -*- coding: utf-8 -*-import pymysqlfrom datetime import datetimetry: conn = pymysql.connect( host = '127.0.0.1', user = 'root', password = 'roo...原创 2018-06-04 13:54:43 · 265 阅读 · 0 评论 -
Python连接mysql[ORM之sqlalchemy]
#!/usr/bin/env python# -*- coding: utf-8 -*-from sqlalchemy import create_enginefrom sqlalchemy.ext.declarative import declarative_basefrom sqlalchemy import Column,Integer,String, DateTime,Boolea...原创 2018-06-04 14:30:45 · 323 阅读 · 0 评论 -
Python连接mysql[ORM之flask_sqlalchemy]
#!/usr/bin/env python# -*- coding: utf-8 -*-from flask import Flaskfrom flask_sqlalchemy import SQLAlchemyfrom flask import render_template,redirect, url_forapp = Flask(__name__)app.config['SQLA...原创 2018-06-04 14:43:00 · 241 阅读 · 0 评论 -
Python连接MongoDB【pymongo】
#!/usr/bin/env python# -*- coding: utf-8 -*-from pymongo import MongoClientfrom datetime import datetimefrom bson.objectid import ObjectIdclass Config(object): '''Mongo配置文件''' host = '...原创 2018-06-05 12:11:31 · 408 阅读 · 0 评论 -
Python连接MongoDB【mongoengine】
#!/usr/bin/env python # encoding: utf-8from datetime import datetimefrom mongoengine import connect, Document, StringField, IntField, FloatField, ListField, DateTimeField, \ EmbeddedDocument...原创 2018-06-05 17:09:24 · 962 阅读 · 0 评论 -
Python连接Redis【redis-py】
#!/usr/bin/env python # encoding: utf-8""" @contact: mic0601@163.com @software: PyCharm @file: sql_redispy.py @time: 2018/6/8 11:19 """import redisclass TestRedis(object): def __init__..原创 2018-06-08 17:40:49 · 774 阅读 · 0 评论 -
python模块paramiko[ssh,sftp]
ssh基于用户名密码连接import paramikossh = paramiko.SSHClient() # 创建SSH对象ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) # 允许连接不在know_hosts文件中的主机ssh.connect(hostname='192.168.1.193',port=22,us...原创 2019-01-17 17:02:40 · 289 阅读 · 0 评论 -
20个常用Python运维库和模块
1、psutil是一个跨平台库(https://github.com/giampaolo/psutil)能够实现获取系统运行的进程和系统利用率(内存,CPU,磁盘,网络等),主要用于系统监控,分析和系统资源及进程的管理。2、IPy(http://github.com/haypo/python-ipy),辅助IP规划。3、dnspython(http://dnspython.org)Pytho...翻译 2019-01-16 15:24:47 · 350 阅读 · 0 评论 -
python运维库之psutil
安装psutilpip install psutil获取CPU信息import psutil# CPU逻辑数量print(psutil.cpu_count())# CPU物理核心print(psutil.cpu_count(logical=False))# 统计CPU的用户/系统/空闲时间print(psutil.cpu_times())# CPU使用率print...翻译 2019-01-16 16:39:33 · 498 阅读 · 0 评论