摘要: manage.py import datetime import json from flask_socketio import Namespace, emit, SocketIO, disconnect from flask import Flask, render_template,reques 阅读全文
posted @ 2019-11-23 00:19 PLAY_JOY 阅读(1947) 评论(0) 推荐(0) 编辑
摘要: 常用命令 #创建用户 useradd <用户名> <可选参数> #可选参数 -c comment 指定一段注释性描述。 -d 目录 指定用户主目录,如果此目录不存在,则同时使用-m 选项,可以创建主目录。 -g 用户组 指定用户所属的用户组。 -G 用户组,用户组 指定用户所属的附加组。 -s Sh 阅读全文
posted @ 2019-11-14 14:45 PLAY_JOY 阅读(501) 评论(0) 推荐(0) 编辑
摘要: from flask import Flask, render_template from flask_session import Session from flask_socketio import SocketIO, emit,send import datetime import time 阅读全文
posted @ 2019-11-12 21:27 PLAY_JOY 阅读(453) 评论(0) 推荐(0) 编辑
摘要: 在《高性能MySQL》中提到,通常情况下最好指定列为NOT NULL,除非真的需要存储NULL值。虽然把NULL 改成NOT NULL 对索引的性能并没有明显提升,但可能会出现不必要的麻烦。 测试如下: CREATE TABLE `t1` ( `id` int(11) NOT NULL, `name 阅读全文
posted @ 2019-10-11 21:04 PLAY_JOY 阅读(416) 评论(0) 推荐(0) 编辑
摘要: def isValid(self,s): stack = [] paren_map = {')': '(', ']': '[', '}': '{'} for c in s: if c not in paren_map: stack.append(c) elif not stack or paren_map[c] !=... 阅读全文
posted @ 2018-10-21 21:26 PLAY_JOY 阅读(357) 评论(0) 推荐(0) 编辑
摘要: class Solution1(object): def __init__(self,x): self.val = x self.next = None def reverse_list(head): cur, pre = head, None while cur: cur.next... 阅读全文
posted @ 2018-10-21 17:43 PLAY_JOY 阅读(294) 评论(0) 推荐(0) 编辑
摘要: with 语句是读写文件的优雅写法 由于文件对象会占用操作系统资源,同时操作系统同一时间打开的文件数量有限,所以在读写的过程中要确保,无论是否出现异常,都需要最后调用close()方法,而with语句会调用close() 其中涉及到的概念: 上下文管理器 定义 自定义上下文管理器 阅读全文
posted @ 2018-10-13 20:45 PLAY_JOY 阅读(173) 评论(0) 推荐(0) 编辑
摘要: ZSET 特点: 类似set集合,有序,元素为字符串,每个元素都关联着一个浮点分数值,并按照分值由小到大的顺序排列 ZADD: 增加一个或者多个元素 ZADD key [NX|XX] [CH] [INCR] score member [score member ...] ZREM:移除一个或多个元素 阅读全文
posted @ 2018-09-30 12:26 PLAY_JOY 阅读(315) 评论(0) 推荐(0) 编辑
摘要: tasks.py 启动 worker: celery -A tasks worker -l info # 参数: -A指定的是app(即Celery实例)所在的文件模块,我们的app是放在tasks.py中,所以这里是 tasks;worker表示当前以worker的方式运行,比如运行定时任务就不用 阅读全文
posted @ 2018-09-17 21:49 PLAY_JOY 阅读(532) 评论(0) 推荐(0) 编辑
摘要: s = [[1, 10], [1.2, 11], [2, 5], [5, 15]] data = zip(*s) x_list = data[0] y_list = data[1] x_min = min(x_list) x_max = max(x_list) y_min = min(y_list) y_max = max(y_list) box = [x_min, x_max, y_min, ... 阅读全文
posted @ 2018-09-11 18:23 PLAY_JOY 阅读(194) 评论(0) 推荐(0) 编辑