会员
周边
众包
新闻
博问
闪存
赞助商
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
lynn_chen
Powered by
博客园
博客园
|
首页
|
新随笔
|
联系
|
订阅
|
管理
上一页
1
2
3
4
5
6
7
8
9
下一页
2018年5月7日
操作 excel - 修改
摘要: ## xlutils import xlrd from xlutils import copy #xlutils 模块得导入单模块使用 book = xlrd.open_workbook('app_student.xls')#先用xlrd模块,打开一个excel new_book = copy.co
阅读全文
posted @ 2018-05-07 10:23 lynn_chen
阅读(94)
评论(0)
推荐(0)
编辑
操作 excel - 读
摘要: import xlrd book = xlrd.open_workbook('app_student.xls') sheet = book.sheet_by_index(0) #根据第几个 sheet 页获取 # sheet2 = book.sheet_by_name('shee1') #根据 sh
阅读全文
posted @ 2018-05-07 10:12 lynn_chen
阅读(105)
评论(0)
推荐(0)
编辑
操作 MySQL - 2
摘要: ###获取字典类型 cur = coon.cursor(cursor = pymysql.cursors.DictCursor) #建立游标;指定 cursor 类型为字典类型 ###fetchall()、fetchone()、fetchmany() fetchall() #获取到这个sql 执行的
阅读全文
posted @ 2018-05-07 09:59 lynn_chen
阅读(88)
评论(0)
推荐(0)
编辑
2018年5月4日
操作 excel - 写
摘要: import xlwt book = xlwt.Workbook() #新建一个excel sheet = book.add_sheet('sheet1') #加sheet页 sheet.write(0,0,'姓名') #行、列、写入的内容 sheet.write(0,1,'年龄') sheet.w
阅读全文
posted @ 2018-05-04 18:23 lynn_chen
阅读(97)
评论(0)
推荐(0)
编辑
操作 MySQL
摘要: import pymysql # 1、连上数据库 账号、密码 ip 端口号 数据库 #2、建立游标 #3、执行sql #4 、获取结果 # 5、关闭游标 #6、连接关闭 coon = pymysql.connect( host='xxx.xxx.xxx.xxx',user='xxxx',passwd
阅读全文
posted @ 2018-05-04 18:15 lynn_chen
阅读(132)
评论(0)
推荐(0)
编辑
加密模块
摘要: import hashlib m = hashlib.md5() # bytes #字符串加密前,必须转为 bytes 类型 passwd = 'NHY_*&^_1982343532' # passwd.encode() #把字符串转成bytes类型 m.update(passwd.encode()
阅读全文
posted @ 2018-05-04 17:28 lynn_chen
阅读(164)
评论(0)
推荐(0)
编辑
时间模块 - time、datetime
摘要: **** time **** import time #1、时间戳 从unix元年到现在过了多少秒#2、格式化好的时间 #先转成时间元组 # print(time.time()) #获取当前时间戳 # time.sleep(10) #停留10s today = time.strftime('%Y-%
阅读全文
posted @ 2018-05-04 16:06 lynn_chen
阅读(137)
评论(0)
推荐(0)
编辑
实例 - 写东西到文件双数日期日志中
摘要: 需求: #把双数日期的日志,写入东西 需求分析 # 1、获取到log目录下面的所有文件 os.walk() # 2、根据文件名来判断,是否是双数日期 ,分割字符串,取到日期 # 3、12%2==0 # 4、打开这个文件 open() import osfor abs_path,dir,file in
阅读全文
posted @ 2018-05-04 15:22 lynn_chen
阅读(120)
评论(0)
推荐(0)
编辑
导入模块的顺序、导入模块的实质、sys模块
摘要: import sys # print(sys.platform) #判断操作系统 # print(sys.path) #python的环境变量 # sys.path.append(r'E:\syz\ly-code\day5') #添加环境变量 # sys.path.insert(0,r'E:\syz
阅读全文
posted @ 2018-05-04 14:39 lynn_chen
阅读(352)
评论(0)
推荐(0)
编辑
模块 - OS
摘要: import os #对操作系统的一些操作 # os.chmod("文件名",权限数字) #更改权限,只适用于Linux(# 1 执行 # 2 写 # 4 读) # print(os.chdir("../day5"))#更改当前目录 # print(os.getcwd()) #获取当前工作目录 #
阅读全文
posted @ 2018-05-04 13:26 lynn_chen
阅读(113)
评论(0)
推荐(0)
编辑
上一页
1
2
3
4
5
6
7
8
9
下一页