随笔分类 -  Python

摘要:一、安装 conda install pymongo 二、使用 1、连接 from pymongo import MongoClient client = MongoClient(host='ip', port=27017) # 使用方括号的方式选择数据库和集合 collection = clien 阅读全文
posted @ 2019-11-26 18:01 市丸银 阅读(223) 评论(0) 推荐(0)
摘要:一、创建数据库 import pymysql conn = pymysql.connect(host='ip', user='root', password='密码') # 以字典的形式返回操作结果 cursor = conn.cursor(cursor=pymysql.cursors.DictCu 阅读全文
posted @ 2019-11-21 18:03 市丸银 阅读(180) 评论(0) 推荐(0)
摘要:基于select 作用:I/O多路复用是用于提升效率,单个进程可以同时监听多个网络连接IO。 server端 client端 主要作用:定制异步框架 阅读全文
posted @ 2019-10-05 13:01 市丸银 阅读(171) 评论(0) 推荐(0)
摘要:server端 client端 阅读全文
posted @ 2019-10-05 12:56 市丸银 阅读(173) 评论(0) 推荐(0)
摘要:作用:快速创建字典 特点:共用value 阅读全文
posted @ 2019-10-04 10:08 市丸银 阅读(609) 评论(0) 推荐(0)
摘要:class PricePolicyInvalid(Exception): def __init__(self, msg): self.msg = msg 阅读全文
posted @ 2019-10-03 20:16 市丸银 阅读(343) 评论(0) 推荐(0)
摘要:作用:一台服务器运行不同版本的模块 1、安装 2、过程 a.创建文件夹,用于储存虚拟环境 b.切换到该文件夹下 c.生成no-site-packages e.激活 f.下载模块 g.使无效 阅读全文
posted @ 2019-10-02 23:34 市丸银 阅读(162) 评论(0) 推荐(0)
摘要:1、下载模块 2、生成文件 阅读全文
posted @ 2019-10-02 23:27 市丸银 阅读(477) 评论(0) 推荐(0)
摘要:基础 进阶 计算文件夹内py文件代码的行数 阅读全文
posted @ 2019-09-29 22:10 市丸银 阅读(68449) 评论(0) 推荐(1)
摘要:参考链接: https://www.cnblogs.com/zhangboblogs/p/7821702.html https://www.cnblogs.com/xiangsikai/p/7787101.html 找了一圈的博客发现大大小小都有问题,还是看源码吧 阅读全文
posted @ 2019-09-29 17:55 市丸银 阅读(296) 评论(0) 推荐(0)
摘要:栈的特点:先进后出 阅读全文
posted @ 2019-09-28 22:32 市丸银 阅读(122) 评论(0) 推荐(0)
摘要:过程:导入模块->创建新的函数 阅读全文
posted @ 2019-09-28 22:19 市丸银 阅读(153) 评论(0) 推荐(0)
摘要:1、pop(key) 删除键值对,返回value2、若字典中没有这个key,则返回None,也可以自定义3、可用作if条件判断 来源: rest framework 框架 Serializer queryset many=True 执行 ListSerializer obj many=False 执 阅读全文
posted @ 2019-09-20 00:09 市丸银 阅读(331) 评论(0) 推荐(0)
摘要:过程参考 https://www.cnblogs.com/liuwei0824/p/8493838.html 代码 有时间上传 阅读全文
posted @ 2019-09-19 10:09 市丸银 阅读(129) 评论(0) 推荐(0)
摘要:推荐使用豆瓣源和命令 速度飞起 pip3 install -i https://pypi.douban.com/simple 模块名称 https://blog.csdn.net/yuzaipiaofei/article/details/80891108 阅读全文
posted @ 2019-09-18 23:56 市丸银 阅读(168) 评论(0) 推荐(0)
摘要:class MyClass : def __init__(self,work) : self.work=work def __getattribute__(self,name) : print("你正在访问一个存在的属性") return super().__getattribute__(name) def __getattr__(self,name) : print("你正在访问一个不存在的属性 阅读全文
posted @ 2019-09-05 19:54 市丸银 阅读(250) 评论(0) 推荐(0)
摘要:一、StringIO 1、作用:在内存在读写str 从内存中读取str,可以和读取文件一样 二、ByteIO 作用:在内存在读取bytes,如图片、视频等 同理,也可以和操作文件一样读取内存的bytes 阅读全文
posted @ 2019-08-07 08:21 市丸银 阅读(815) 评论(0) 推荐(0)
摘要:import os import sys parent_path = os.path.dirname(os.getcwd()) sys.path.insert(0, parent_path) from core import main if __name__ == '__main__': main.main() 阅读全文
posted @ 2019-08-04 13:37 市丸银 阅读(119) 评论(0) 推荐(0)
摘要:1、datatime.datatime 作用:.now()获取当前的时间 注意:时间的数据类型,datatime.datatime 2、datatime.timedelta 详情参考: https://www.cnblogs.com/dingtianwei/p/9493356.html 阅读全文
posted @ 2019-07-28 22:43 市丸银 阅读(110) 评论(0) 推荐(0)
摘要:1、重点:数据库插入数据需要进行 事物提交 其它:事物回滚 2、注意:lastrowid是 光标的一个属性 3、批量添加数据 注意:批量添加的数据类型 阅读全文
posted @ 2019-07-19 08:14 市丸银 阅读(164) 评论(0) 推荐(0)