摘要: ## @api.one 新api定义: 1 qty = fields.Integer(string="qty", compute="_get_qty") 2 3 @api.one 4 def _get_qty(self): 5 self.qty = random.randint(1, 10) one 阅读全文
posted @ 2020-06-04 15:00 北方男孩 阅读(1234) 评论(0) 推荐(0) 编辑
摘要: 表1:user 字段 id、name、 age、 gender 表2:goods 字段id、name、price 表3:re_ug 字段id、uid、 gid 1.提高复用性,貌似函数抽出的公用方法,别的方法可以调用。 如果频繁获取user表的name和age就要不断写下面的sql sql sele 阅读全文
posted @ 2019-03-05 16:15 北方男孩 阅读(692) 评论(0) 推荐(0) 编辑
摘要: Python版本:Python3 一、安装Pyinstaller 1、安装pywin32 下载安装文件:查找到跟自己适用的python版本及window系统版本匹配的pywin32,下载后安装 使用pip命令安装:pip install pywin32 2、安装Pyinstaller 下载安装文件安 阅读全文
posted @ 2018-11-29 09:12 北方男孩 阅读(439) 评论(0) 推荐(0) 编辑
摘要: 在ubuntu 16.04版本中,系统默认安装 了python 2.7和3.5版本,因为系统本身用到python的程序,删除默认的版本又担心系统有问题,那有没有办法同时在安装和使用python 3.6版本呢?下文将一起安装python 3.6并修改原系统的python3命令以使用新安装的版本。 1、 阅读全文
posted @ 2018-10-25 18:09 北方男孩 阅读(246) 评论(0) 推荐(0) 编辑
摘要: 这个问题我在自己代码中跟中转换编码都不行,总出错! 介绍一种便捷方法,直接改源码: 直接找到zipfile.py文件 第一处: 第二处: 完美解决!!!! 阅读全文
posted @ 2018-10-19 21:10 北方男孩 阅读(3993) 评论(0) 推荐(1) 编辑
摘要: 在Python我们要判断一个文件对当前用户有没有读、写、执行权限,我们通常可以使用os.access函数来实现,比如: # 判断读权限os.access(<my file>, os.R_OK)# 判断写权限os.access(<my file>, os.W_OK)# 判断执行权限os.access( 阅读全文
posted @ 2018-10-18 15:28 北方男孩 阅读(2138) 评论(0) 推荐(0) 编辑
摘要: 1.邮箱验证: re.compile(r"^[a-z0-9.\-\_]{1,50}@[a-z0-9\-]+(\.[a-z]{2,5}){1,2}$", re.I).match(datas["email"]) 2.传url链接: parse.urlencode(字典) parse.unquote(字符 阅读全文
posted @ 2018-10-16 13:38 北方男孩 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 介绍 RabbitMQ是一个在AMQP基础上完整的,可复用的企业消息系统。他遵循Mozilla Public License开源协议。MQ全称为Message Queue, 消息队列(MQ)是一种应用程序对应用程序的通信方法。应用程序通过读写出入队列的消息(针对应用程序的数据)来通信,而无需专用连接 阅读全文
posted @ 2018-10-15 20:06 北方男孩 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 英文文档: eval(expression, globals=None, locals=None)The arguments are a string and optional globals and locals. If provided, globals must be a dictionary 阅读全文
posted @ 2018-10-13 16:50 北方男孩 阅读(480) 评论(0) 推荐(0) 编辑
摘要: 英文文档: exec(object[, globals[, locals]])This function supports dynamic execution of Python code. object must be either a string or a code object. If it 阅读全文
posted @ 2018-10-13 16:49 北方男孩 阅读(1444) 评论(0) 推荐(0) 编辑