会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
面包树下的路人
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
下一页
2019年11月4日
python连接redis
摘要: import redis r = redis.Redis(host='118.24.3.40',password='HK139bc&*',port=6379,db=0,decode_responses=True) 1.字符串(key,value形式) r.set('mjz_students','{"
阅读全文
posted @ 2019-11-04 22:00 面包树下的路人
阅读(137)
评论(0)
推荐(0)
2019年10月31日
python3进行md5加密
摘要: import hashlib,base64 # md5加密s = '123'm = hashlib.md5(s.encode())res = m.hexdigest()print(res) # MD5加密+加盐def md5(s,salt=''): new_s = str(s) + salt m =
阅读全文
posted @ 2019-10-31 21:44 面包树下的路人
阅读(4656)
评论(0)
推荐(1)
2019年10月30日
python操作mysql数据库
摘要: import pymysql 连接数据库方法1: ip ="192.168.xx.xx"user = 'jxz'password="123456"db='jxz'port=3306charset='utf8'conn = pymysql.connect(host=ip,user=user,passw
阅读全文
posted @ 2019-10-30 22:31 面包树下的路人
阅读(198)
评论(0)
推荐(0)
python3操作excle
摘要: 1.写操作 import xlwt book = xlwt.Workbook() # 新建一个工作簿 sheet = book.add_sheet('Sheet1') # 新建一个工作表 sheet.write(0,0,'test') # 在第一行第一列新增一条数据 stus = [ ['id',
阅读全文
posted @ 2019-10-30 21:37 面包树下的路人
阅读(172)
评论(0)
推荐(0)
2019年10月23日
memcache与redis的存储类型
摘要: memcache支持简单的数据类型,想要存入复杂的数据类型必须把复杂的数据类型转变成简单的数据类型。 redis支持的五大数据类型: 1.String(字符串) string类型是二进制安全的。意思是redis的string可以包含任何数据。比如jpg图片或者序列化的对象 。 string类型是Re
阅读全文
posted @ 2019-10-23 18:20 面包树下的路人
阅读(774)
评论(0)
推荐(0)
2019年10月22日
模块
摘要: 1.OS模块 import os os.remove('a.txt') # 删除a.txt文件print(os.rename('a.txt','b.txt')) # 将a.txt文件名修改成b.txtos.mkdir('c.txt') # 创建一个c.txt的文件夹os.makedirs(r'C:\
阅读全文
posted @ 2019-10-22 22:43 面包树下的路人
阅读(132)
评论(0)
推荐(0)
函数
摘要: 1.函数的定义: 函数是指将一组语句的集合通过一个名字(函数名)封装起来,要想执行这个函数,只需调用其函数名即可 2.函数的参数 函数在调用的时候,可以传入参数,有形参和实参 形参: 形参变量只有在被调用时才分配内存单元,在调用结束时,即刻释放所分配的内存单元。因此,形参只在函数内部有效。 实参:
阅读全文
posted @ 2019-10-22 22:01 面包树下的路人
阅读(133)
评论(0)
推荐(0)
2019年9月23日
json与字典相互转换
摘要: 1.将字典转成json import json dic = {'name':'wangyujian','sex':'男','age':18} js = json.dumps(dic,ensure_ascii=False) # ensure_ascii=False 将字典中的中文编码转换一下,不然输出
阅读全文
posted @ 2019-09-23 17:33 面包树下的路人
阅读(5169)
评论(0)
推荐(0)
2019年9月20日
常用的Random函数
摘要: 一、random.random()随机生成[0,1]的浮点数import randomprint("random.random:", random.random()) 二、random.randint(min,max)随机生成[min,max]范围内的整数print("random.randint(
阅读全文
posted @ 2019-09-20 16:08 面包树下的路人
阅读(1446)
评论(0)
推荐(0)
2019年9月16日
字符串常用方法
摘要: 1.常用: s = ' ABCdefGH ' s.strip() # 去掉左右两端的空格s.lstrip() # 去掉左边空格s.rstrip() # 去掉右边空格s.lower() # 将字符串全部转小写s.upper() # 将字符串全部转大写s.count('a') # 统计字符串中a一共有多
阅读全文
posted @ 2019-09-16 17:20 面包树下的路人
阅读(192)
评论(0)
推荐(0)
上一页
1
2
3
4
下一页
公告