1 Star 0 Fork 15

hyoyee / day0515_jackfrued

forked from jackfrued / review 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
example02.py 426 Bytes
一键复制 编辑 原始数据 按行查看 历史
jackfrued 提交于 2020-05-15 16:26 . 新增了操作数据库的代码
import MySQLdb
conn = MySQLdb.connect(host='47.104.31.138', port=3306,
user='hellokitty', passwd='Hellokitty.618',
db='hrs', charset='utf8')
try:
with conn.cursor(MySQLdb.cursors.DictCursor) as cursor:
cursor.execute('select dno as no, dname as name, dloc as loc from tb_dept')
for dept in cursor.fetchall():
print(dept)
finally:
conn.close()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hyoyee/day0515_jackfrued.git
git@gitee.com:hyoyee/day0515_jackfrued.git
hyoyee
day0515_jackfrued
day0515_jackfrued
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891