作为近两年来最火的编程语言的python,受到广大程序员的追捧必然是有其原因的,如果要挑出几点来讲的话,第一条那就python语法简洁,易上手,第二条呢?
便是python有着极其丰富的第三方的库。
所以不管你使用的关系型数据库是oracle,mysql, sqlserver,还是关系型数据库redis,mongoDB。
python都有有与之对应的第三方库。
下面就来为大家一一介绍一下!


Mysql
我们先来看看如何对接mysql数据库,python2和python3中对接mysql的库是不一样的。
在我们以这里python3为标准(毕竟python2在不久的将来官方就不再维护了)。
在python3中对接mysql数据库使用到的库为pymysql模块。
1、安装pymysql

2、快速上手


Oracle
python中对接oracle数据库,使用的第三方库为cx_Oracle
1、安装

2、快速上手


Sql—server
python对接sqlserver使用的第三方库:pymssql
1、安装pymassql

2、快速上手


PostgreSQL
python对接postgreSQL使用的模块是psycopg2
1、安装

2、快速上手


MongoDB
python中操作mongodb使用的第三方库为 pymongo
1、安装pymogo

2、快速上手


Redis
python操作redis的模块为redis
1、安装

2、快速上手
