文章分类 -  Python-b-扩展

摘要:1. 判断当前:是 linux or windows def is_linux(): # linux系统 if os.name == "posix": return True else: return False 2. 写文件txt # 写文件 txt def write_content_txt(s 阅读全文
posted @ 2021-06-23 14:38 Alice的小屋 阅读(332) 评论(0) 推荐(0) 编辑
摘要:下载文件 from django.http import HttpResponse, Http404, StreamingHttpResponse, FileResponse def f(request): file = open('/Users/ct/dev_ops_3/upload/front_ 阅读全文
posted @ 2019-01-22 18:49 Alice的小屋 阅读(255) 评论(0) 推荐(0) 编辑
摘要:阿里云语音服务接口 https://help.aliyun.com/document_detail/55488.html https://www.cnblogs.com/itfat/p/8393181.html https://help.aliyun.com/document_detail/5548 阅读全文
posted @ 2019-01-22 18:39 Alice的小屋 阅读(2049) 评论(0) 推荐(0) 编辑
摘要:schedule: 定时任务 https://blog.csdn.net/qq_39687901/article/details/81985767 https://www.cnblogs.com/anpengapple/p/8051923.html 官网:https://schedule.readt 阅读全文
posted @ 2019-01-22 18:35 Alice的小屋 阅读(204) 评论(0) 推荐(0) 编辑
摘要:方法一:可以使用//求取两数相除的商、%求取两数相除的余数。[/在Python中获取的是相除的结果,一般为浮点数] 方法二:使用divmod()函数,获取商和余数组成的元祖 #!/usr/bin/python3 # -*- coding: utf-8 -*- a = int(input(u"输入被除 阅读全文
posted @ 2018-11-20 12:11 Alice的小屋 阅读(6439) 评论(0) 推荐(0) 编辑
摘要:https://pymotw.com/3/ https://github.com/alice-bj/py3_module https://blog.csdn.net/scotthuang1989/article/details/77165112 阅读全文
posted @ 2018-08-30 16:13 Alice的小屋 阅读(1026) 评论(0) 推荐(0) 编辑
摘要:SimpleORM # -*- coding: utf-8 -*- class Field(object): def __init__(self, name, column_type, required, field_type): self.name = name self.column_type 阅读全文
posted @ 2018-08-11 14:59 Alice的小屋 阅读(103) 评论(0) 推荐(0) 编辑
摘要:Python中的描述符 描述符的定义: 通常情况下,我们可以认为"假设对象的某个属性被绑定了(get, set, delete)这三个方法中的任意一个方法",那么我们称该属性为"描述符" 我们不能称 foo.name, foo.age 这两个属性为描述符,因为它们都没有绑定上面三个方法。 默认情况下 阅读全文
posted @ 2018-08-11 14:54 Alice的小屋 阅读(122) 评论(0) 推荐(0) 编辑
摘要:python实现栈 class FooStack(object): def __init__(self): self.items = [] def push(self,item): self.items.append(item) def pop(self): return self.items.po 阅读全文
posted @ 2018-07-27 11:56 Alice的小屋 阅读(1318) 评论(0) 推荐(0) 编辑
摘要:dict1={1:[1,11,111],2:[2,22,222]}dict2={3:[3,33,333],4:[4,44,444]}合并两个字典得到类似 {1:[1,11,111],2:[2,22,222],3:[3,33,333],4:[4,44,444]} 方法1: dictMerged1=di 阅读全文
posted @ 2018-07-26 20:43 Alice的小屋 阅读(203) 评论(0) 推荐(0) 编辑
摘要:多路 I/O 复用模型是利用select、poll、epoll可以同时监察多个流的 I/O 事件的能力,在空闲的时候,会把当前线程阻塞掉,当有一个或多个流有I/O事件时,就从阻塞态中唤醒,于是程序就会轮询一遍所有的流(epoll是只轮询那些真正发出了事件的流),并且只依次顺序的处理就绪的流,这种做法 阅读全文
posted @ 2018-07-26 09:44 Alice的小屋 阅读(109) 评论(0) 推荐(0) 编辑
摘要:1. django请求生命周期 -> 执行遵循wsgi协议的模块(socket服务端) -> 中间件(路由匹配) -> 视图函数(业务处理:ORM、模板渲染) -> 中间件 -> wsgi返回 - wsgi, 他就是socket服务端,用于接收用户请求并将请求进行初次封装,然后将请求交给web框架( 阅读全文
posted @ 2018-07-17 20:46 Alice的小屋 阅读(242) 评论(0) 推荐(0) 编辑
摘要:1.常见的数据类型中的方法 字符串 字典 列表 常用方法 caplitalize upper lower find rfind center ljust rjust format index strip lstrip() rstrip() append insert extend count pop 阅读全文
posted @ 2018-07-14 17:04 Alice的小屋 阅读(123) 评论(0) 推荐(0) 编辑
摘要:引用: http://www.cnblogs.com/ctztake/articles/8541948.html http://www.cnblogs.com/ctztake/articles/8506369.html http://www.cnblogs.com/ctztake/articles/ 阅读全文
posted @ 2018-07-14 16:23 Alice的小屋 阅读(136) 评论(0) 推荐(0) 编辑
摘要:https://www.cnblogs.com/wupeiqi/p/9078770.html https://www.cnblogs.com/wupeiqi/p/8629419.html http://www.cnblogs.com/alex3714/articles/5930715.html 第一 阅读全文
posted @ 2018-07-11 15:42 Alice的小屋 阅读(103) 评论(0) 推荐(0) 编辑
摘要:一、对rest api的认识 http://www.cnblogs.com/wupeiqi/articles/7805382.htmlhttp://www.ruanyifeng.com/blog/2014/05/restful_api.html原来web应用程序时,根据url不同定位到不同视图函数处 阅读全文
posted @ 2018-07-07 10:29 Alice的小屋 阅读(144) 评论(0) 推荐(0) 编辑
摘要:数据: 1,Alex Li,22,13651054608,IT,2013-04-01 2,Jack Wang,28,13451024608,HR,2015-01-07 3,Rain Wang,21,13451054608,IT,2017-04-01 4,Mack Qiao,44,1565335420 阅读全文
posted @ 2018-05-17 20:33 Alice的小屋 阅读(330) 评论(0) 推荐(0) 编辑
摘要:决定开始Python之路了,利用业余时间,争取更深入学习Python。编程语言不是艺术,而是工作或者说是工具,所以整理并遵循一套编码规范是十分必要的。 PEP8 Python 编码规范 https://www.python.org/dev/peps/pep 0008/ 一 代码编排 1. 缩进。4个 阅读全文
posted @ 2018-05-17 09:46 Alice的小屋 阅读(252) 评论(0) 推荐(0) 编辑
摘要:1 # -*- coding:utf-8 -*- 2 import sys 3 import optparse 4 5 def fun(): 6 print('hello world') 7 print(sys.argv) 8 9 fun() 10 11 """ 12 终端执行: 13 python 阅读全文
posted @ 2018-03-27 08:54 Alice的小屋 阅读(214) 评论(0) 推荐(0) 编辑
摘要:tabulate 1 # -*- coding:utf-8 -*- 2 from tabulate import tabulate 3 li_data = [['王信鑫', '27', '13478683345'], ['马纤羽', '34', '13744234523'], ['叶梓萱', '24 阅读全文
posted @ 2018-03-06 23:15 Alice的小屋 阅读(946) 评论(3) 推荐(0) 编辑