Python就业班——新闻管理系统
2021-03-17 09:26
标签:col back mysql https cli 管理 imp color local colorama test.py mysql_db.py redis_db.py mongo_db.py gitee:https://gitee.com/lgsp_Harold/Ex_vega Python:3.6 Redis:3.2.100 Mysql:8.0.17 MongoDB:4.0.11 效果图:自行运行代码查看或自行幻想.... Python就业班——新闻管理系统 标签:col back mysql https cli 管理 imp color local 原文地址:https://www.cnblogs.com/Harold-Hua/p/13680762.html#!/usr/bin/env python3
# coding=utf-8
# Version:python3.6.1
# Project:vega
# File:test.py
# Data:2020/9/16 13:20
# Author:LGSP_Harold
from colorama import Back, Fore, Style
print(Fore.LIGHTRED_EX, ‘Hi‘)
print(Back.LIGHTBLUE_EX, ‘Jim‘)
print(Style.RESET_ALL, ‘Bye‘)
if __name__ == ‘__main__‘:
pass
#!/usr/bin/env python3
# coding=utf-8
# Version:python3.6.1
# Project:vega
# File:mysql_db.py
# Data:2020/9/16 15:47
# Author:LGSP_Harold
import pymysql
from DBUtils.PooledDB import PooledDB
__config = {
‘host‘: ‘localhost‘,
‘port‘: 3306,
‘user‘: ‘root‘,
‘passwd‘: ‘root‘,
‘db‘: ‘vega‘,
‘charset‘: ‘utf8‘
}
try:
pool = PooledDB(pymysql, 10, **__config)
except Exception as e:
print(e)
if __name__ == ‘__main__‘:
pass
#!/usr/bin/env python3
# coding=utf-8
# Version:python3.6.1
# Project:Ex_vega
# File:redis_db.py.py
# Data:2020/11/13 16:23
# Author:LGSP_Harold
import redis
try:
pool = redis.StrictRedis(
host=‘localhost‘,
port=6379,
password=‘root‘,
db=3,
max_connections=20
)
except Exception as e:
print(e)
if __name__ == ‘__main__‘:
pass
#!/usr/bin/env python3
# coding=utf-8
# Version:python3.6.1
# Project:Ex_vega
# File:mongo_db.py
# Data:2020/11/14 12:01
# Author:LGSP_Harold
from pymongo import MongoClient
try:
client = MongoClient(host=‘localhost‘, port=27017)
client.admin.authenticate(‘admin‘, ‘admin‘)
except Exception as e:
print(e)
if __name__ == ‘__main__‘:
pass
下一篇:java设计模式之装饰器模式