![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python学习
Zoey今天
挺懒,也挺认真
展开
-
python函数定义及调用方式,不定项参数使用
函数:做事情的一个方法和过程定义函数def changestr(strings, method='lower'): if method == 'lower': return strings.lower() elif method == 'upper': return strings.upper()调用函数注意:(函数只有在调用的时候才能发生作用)1.参数的个数和调用时要一一对应lst='abcdFRES'newlst = changestr(原创 2020-12-04 15:54:26 · 346 阅读 · 0 评论 -
python连接数据库并获取表中内容
python连接MySQL数据库import pymysql#导入pymysql库mysql_dict = { 'port': 3306, 'user':'root', 'host':'localhost', 'password':'123456', 'database':'userinfo'}db=pymysql.connect(**mysql_dict) #连接数据库cursor = db.cursor() #定义一个游标cursor.execute原创 2020-12-02 10:42:40 · 2053 阅读 · 0 评论 -
python读取excel表格内容
python打开excel表格python打开excel表格,并读取内容一、使用Pycharm编辑器编写如下代码示例:python打开excel表格使用Pycharm编辑器编写如下代码import xlrdxlsfile="D:\Persional\用户.xls" #excel文件的路径book=xlrd.open_workbook(xlsfile) #打开excel文件sheet0=book.sheet_by_index(0) #打开目标sheet页签c原创 2020-11-30 16:34:39 · 2363 阅读 · 3 评论