上一页 1 ··· 34 35 36 37 38 39 40 41 42 ··· 55 下一页
摘要: 内层函数没有引用外层函数局部变量,dir()是不会显示的 def b(a): def p(): print('function p dir ->',dir()) p() print('function b dir ->',dir()) b(2) def b(a): def p(): nonlocal 阅读全文
posted @ 2020-11-11 14:50 ascertain 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 只加强一次功能的装饰器: print('/\\') print('/\ta') def b(fn): def wrapper(): print('bbbbb') return fn return wrapper() @b def p(): print(111111111) print(p) p() 阅读全文
posted @ 2020-11-11 14:38 ascertain 阅读(72) 评论(0) 推荐(0) 编辑
摘要: 首选要查找占用大量磁盘空间的文件,基本是长久不清理的日志文件 du --exclude=/proc --total -sh /* | sort -hr find / ! -path '/proc*' -size +200M -print 通过上面两台命令可以快速找出大文件,但是不能贸然删除日志文件, 阅读全文
posted @ 2020-11-10 11:34 ascertain 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 当前用户拿到所有权 takeown /f 'c:\nm' /r /d y 修改当前用户对文件夹的访问权限,确保有权删除 cacls 'c:\nm' /t /e /g yangche\zhanggw:f 删除目录 rd /s /q 'c:\nm' 阅读全文
posted @ 2020-11-09 21:12 ascertain 阅读(156) 评论(0) 推荐(0) 编辑
摘要: Cygwin是Windows下模拟Linux环境的软件,最初由Cygnus Solutions研发,通过重新编译将Linux上的软件移植到Windows 官网: http://www.cygwin.com/ 1.安装Cygwin需要到官网下载安装包。在该网站首页的Current Cygwin DLL 阅读全文
posted @ 2020-11-09 20:21 ascertain 阅读(699) 评论(0) 推荐(0) 编辑
摘要: mysql中utf8和utf8mb4区别 MySQL在5.5.3之后增加了这个utf8mb4的编码,mb4就是most bytes 4的意思,专门用来兼容四字节的unicode。好在utf8mb4是utf8的超集,除了将编码改为utf8mb4外不需要做其他转换。当然,为了节省空间,一般情况下使用ut 阅读全文
posted @ 2020-11-09 19:10 ascertain 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 选用场景: 字段平均长度与极值相差小,选用char,反之,选用varchar 字段需要频繁更新,考虑char,char为定长,不容易产生碎片 字段存储信息很短,考虑char,varchar会占用额外空间保存长度信息 定长字段优选char 阅读全文
posted @ 2020-11-09 16:47 ascertain 阅读(83) 评论(0) 推荐(0) 编辑
摘要: comment查看comment show create table 'table_name'; show full columns from 'table_name'; 修改comment alter table 'table_name' modify column 'column_name' ' 阅读全文
posted @ 2020-11-09 09:34 ascertain 阅读(52) 评论(0) 推荐(0) 编辑
摘要: 应用程序端: 应用程序应该是一个可调用对象 Python中应该是函数,类,实现了call方法的类的实例 可调用对象应该接收两个参数 函数实现: def application(environ,start_response): pass 类实现 class Application: def __ini 阅读全文
posted @ 2020-11-09 00:42 ascertain 阅读(147) 评论(0) 推荐(0) 编辑
摘要: def b(fn): print(111111111) def wrapper(*args,**kwargs): print(22222222222222) ret=fn(*args,**kwargs) return ret return wrapper def p(fn): print('x'*6 阅读全文
posted @ 2020-11-08 17:13 ascertain 阅读(83) 评论(0) 推荐(0) 编辑
摘要: 事件循环是asyncio提供的核心运行机制 column column asyncio.get_event_loop() 返回一个事件循环对象,时asyncio.BaseEventLoop的实例 AbstractEventLoop.stop() 停止运行事件循环 AbstractEventLoop. 阅读全文
posted @ 2020-11-07 13:52 ascertain 阅读(135) 评论(0) 推荐(0) 编辑
摘要: import datetime,threading def aa(v, a, b): print(v,a,b) timer=threading.Timer(interval=2,function=aa,args=(2,),kwargs={'a':'22222','b':'3333333333'}) 阅读全文
posted @ 2020-11-06 16:39 ascertain 阅读(376) 评论(0) 推荐(0) 编辑
摘要: import selectors,socket,threading selector=selectors.DefaultSelector() def accept(socket:socket.socket): conn,client=socket.accept() print('accept new 阅读全文
posted @ 2020-11-06 00:45 ascertain 阅读(146) 评论(0) 推荐(0) 编辑
摘要: datetime.datetime & datetime.time 两个类构造时可传tzinfo参数, 都会把tzinfo绑定到self._tzinfo属性上, 可通过tzinfo属性访问 __str__依次调用一下方法 class tzinfo: """Abstract base class fo 阅读全文
posted @ 2020-11-05 16:45 ascertain 阅读(709) 评论(0) 推荐(0) 编辑
摘要: 简单说明HTML <table> 标签 定义和用法 <table> 标签定义 HTML 表格。 简单的 HTML 表格由 table 元素以及一个或多个 tr、th 或 td 元素组成。 border 定义表格 <tr> 元素定义表格行,<th>元素定义表头,<td> 元素定义表格单元。 <capt 阅读全文
posted @ 2020-11-04 22:50 ascertain 阅读(1182) 评论(0) 推荐(0) 编辑
摘要: 当前数据库: 内置函数database() select database(); show tables; status \s 当前用户: select user(); select current_user; 阅读全文
posted @ 2020-11-02 19:26 ascertain 阅读(1511) 评论(0) 推荐(0) 编辑
摘要: /y overwrite existing destination files without prompting 目标存在此文件时,取消默认提示是否覆盖 /s 递归copy,默认只copy src下的文件 /i dst目录不存在时,创建dst目录,否则会提示如下 /e 默认不会copy空目录,/e 阅读全文
posted @ 2020-11-02 15:18 ascertain 阅读(408) 评论(0) 推荐(0) 编辑
摘要: #!/bin/sh echo "Num of arguments: $#" echo "Current PID: $$" echo "BASHPID: $BASHPID" sleep 10 & echo "The last deforegroud PID: $!" echo "The current 阅读全文
posted @ 2020-11-02 11:38 ascertain 阅读(72) 评论(0) 推荐(0) 编辑
摘要: + +| BaseServer |+ + | v+ + + +| TCPServer | >| UnixStreamServer |+ + + + | v+ + + +| UDPServer | >| UnixDatagramServer |+ + + +socketserver有四个同步类: TC 阅读全文
posted @ 2020-11-01 17:54 ascertain 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 由于Python的GIL,多进程并非CPU密集型程序的better choice 多进程可以完全独立的进程环境中运行程序,可以充分的利用多核心 但进程本身隔离带来数据共享问题,而且线程比进程轻量级 multiprocessing Process类: import multiprocessing,da 阅读全文
posted @ 2020-10-30 21:09 ascertain 阅读(132) 评论(0) 推荐(0) 编辑
上一页 1 ··· 34 35 36 37 38 39 40 41 42 ··· 55 下一页