11 2018 档案

摘要:1. 路径操作 比起 os 模块的 path 方法,python3 标准库的 pathlib 模块的 Path 处理起路径更加的容易。 ####获取当前文件路径 前提导入 os 和 pathlib 包。。 os 版: pathlib 版: 看着好像没啥区别,然后看下面这个。 获取上两级文件目录 os 阅读全文
posted @ 2018-11-26 19:41 CrossPython 阅读(357) 评论(0) 推荐(0) 编辑
摘要:获取其他线程的数据用 queue, 多进程Q 阅读全文
posted @ 2018-11-26 10:10 CrossPython 阅读(288) 评论(0) 推荐(0) 编辑
摘要:#coding:utf-8 import time,asyncio a=time.time() id=1 async def hello(id,semaphore): async with semaphore: await asyncio.sleep(1) print('working id:'+str(id)) async def run(): ... 阅读全文
posted @ 2018-11-25 11:16 CrossPython 阅读(1862) 评论(0) 推荐(0) 编辑
摘要:https://my.oschina.net/backbye/blog/1919486 asyncio 提供了两个给运行中的事件循环(loop) 添加 事件的方法 call_soon_threadsafe() 、run_coroutine_threadsafe() 因为我们一般的场景中会另起一个线程 阅读全文
posted @ 2018-11-25 10:33 CrossPython 阅读(1135) 评论(0) 推荐(0) 编辑
摘要:https://linux.cn/article-8051-1.html 阅读全文
posted @ 2018-11-24 19:57 CrossPython 阅读(137) 评论(0) 推荐(0) 编辑
摘要:https://blog.csdn.net/qq_29349715/article/details/79730786 python协程只能运行在事件循环中,但是一旦事件循环运行,又会阻塞当前任务。所以只能在当前进程中再开一个线程,这个线程的主要任务是运行事件循环,就是event_loop,因为他是一 阅读全文
posted @ 2018-11-24 19:28 CrossPython 阅读(1416) 评论(1) 推荐(1) 编辑
摘要:http://python.jobbole.com/87310/ 阅读全文
posted @ 2018-11-24 18:34 CrossPython 阅读(195) 评论(0) 推荐(0) 编辑
摘要:对jetbrains公司出品的IDE均有效,以rubymine为例: 打开C:\Program Files\JetBrains\RubyMine 6.3.3\bin,打开 rubymine.exe.vmoptions 文件,修改-Xmx512m 为 -Xmx1024m,其它IDE雷同,此法在linu 阅读全文
posted @ 2018-11-23 19:16 CrossPython 阅读(556) 评论(0) 推荐(0) 编辑
摘要:干掉 \Lib\fcntl.py 阅读全文
posted @ 2018-11-23 10:28 CrossPython 阅读(1053) 评论(0) 推荐(0) 编辑
摘要:https://docs.djangoproject.com/en/2.1/ref/contrib/sitemaps/ very good 阅读全文
posted @ 2018-11-18 19:13 CrossPython 阅读(196) 评论(0) 推荐(0) 编辑
摘要:记下来,省得每次google过滤器,变量的显示形式的改变一、形式:小写{{ name | lower }} 二、串联:先转义文本到HTML,再转换每行到 <p> 标签{{ my_text|escape|linebreaks }} 三、过滤器的参数显示前30个字{{ bio | truncatewor 阅读全文
posted @ 2018-11-11 19:44 CrossPython 阅读(1581) 评论(0) 推荐(0) 编辑
摘要:当时想做一个多条件查询,但是对于要查询的信息,是分布在不同的表里,这就涉及到了多表查询问题。 DjangoBook里提到了一些查询的方式,但是不够全面,就去百度搜了下。 当去网上百度搜多表查询,或多条件查询时,都能搜到,但是相对较综合点的信息,还是比较少。但是为了实现功能, 也思考了不少。下面贴上一 阅读全文
posted @ 2018-11-08 21:46 CrossPython 阅读(1417) 评论(0) 推荐(0) 编辑
摘要:null 不设置时默认设置为False。设置为True时,数据库表字段中将存入NULL的记录。 null和blank组合使用,null=True,blank=True,表示该字段可以为空 blank 默认设置为False。设置为True时,表字段许可无任何输入。设置为False 时,表字段为必须输入 阅读全文
posted @ 2018-11-08 21:05 CrossPython 阅读(3054) 评论(0) 推荐(0) 编辑
摘要:yum install nodejs 阅读全文
posted @ 2018-11-04 21:47 CrossPython 阅读(416) 评论(0) 推荐(0) 编辑
摘要:import os, sys import django BASE_DIR = os.path.dirname(os.path.abspath(__file__)) # 定位到你的django根目录 sys.path.append(os.path.abspath(os.path.join(BASE_DIR, os.pardir))) os.environ.setdefault("DJANGO_... 阅读全文
posted @ 2018-11-04 19:29 CrossPython 阅读(196) 评论(0) 推荐(0) 编辑
摘要:分 时 日 月 周 命令(最好用绝对路径)比如: * * * * * rm -fr /mnt/* //每分钟执行一次对/mnt目录下文件的删除*/2 * * * * rm -fr /mnt/* //每隔两分钟执行一次*/2 08-17 1,15 3-5 3 rm -fr /mnt/* //在3-5月 阅读全文
posted @ 2018-11-04 18:57 CrossPython 阅读(411) 评论(0) 推荐(0) 编辑
摘要:https://blog.csdn.net/pipisorry/article/details/47905781 阅读全文
posted @ 2018-11-02 12:39 CrossPython 阅读(378) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示