PJzhang:python基础入门的7个疗程-seven
source link: http://www.cnblogs.com/landesk/p/11509726.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
猫宁!!!
参考链接:易灵微课-21天轻松掌握零基础python入门必修课
https://www.liaoxuefeng.com/wiki/1016959663602400
第19天:开源模块
数据库连接对象connection(建立python程序和mysql服务器之间的通道),数据库游标对象cursor(运送数据的载具)。
安装数据库相关的python模块
pip install PyMySQL,注意这里的大小写区分。
新建连接,查询编辑器,选中运行,刷新之后可以看到mydb数据库已经创建好,里面有一个表sgrade
选中mydb,新建查询,输入select * from sgrade;
要导入的txt文件
成功将文件导入,这里用的是mariadb远程连接
显示
获取数据库中所有的成绩,注释掉一部分不相关的
显示
获取单个学生的成绩
显示
第20天:开源模块
xlwt模块生成excel文件
xlrd读取excel(很少使用),xlwt生成excel
目的是将input.txt中的学生成绩信息生成excel中。
程序代码,生成学生成绩表.xls,sheet名字是学生成绩表,row是行,col是列。
excel成绩表
第21天:开源模块
multiprocessing模块,多进程
生成URL
显示
多线程,8个进程同时进行
显示结果
21节大总结
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK