上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 55 下一页
摘要: Python: 当 \char 不构成转义序列时, \ 被作为普通字符, \1 \100 八进制转义序列 Javascript: Java: 阅读全文
posted @ 2022-03-03 10:08 ascertain 阅读(26) 评论(0) 推荐(0) 编辑
摘要: import re from collections import defaultdict regex = re.compile(r'[^\w-]+') valor = defaultdict(lambda: 0) with open(file = 'statistic.txt', mode = ' 阅读全文
posted @ 2022-03-02 23:45 ascertain 阅读(20) 评论(0) 推荐(0) 编辑
摘要: IP -> int import socket ip = '5.5.5.5' def inet_aton(a: str): n = 0 for i, v in enumerate(reversed([int(n) for n in a.split('.')])): n += v << (8 * i) 阅读全文
posted @ 2022-03-02 16:57 ascertain 阅读(40) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2022-03-01 13:51 ascertain 阅读(19) 评论(0) 推荐(0) 编辑
摘要: newline: (windows) Only for text mode 写: newline=None (default) newline='' newline='\n' other Summarize: 写文件时, 全部使用 '\n' , newline=None 替换成 os.linesep 阅读全文
posted @ 2022-03-01 13:29 ascertain 阅读(36) 评论(0) 推荐(0) 编辑
摘要: list derivatives & dict deconstruction ebb = dict(zip('abcde', (11, 22, 11, 33, 22))) print(ebb) print([k for k, v in ebb.items() if v == 11]) filter 阅读全文
posted @ 2022-02-28 16:54 ascertain 阅读(20) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2022-02-28 14:30 ascertain 阅读(17) 评论(0) 推荐(0) 编辑
摘要: lru_cache import functools, time @functools.lru_cache(maxsize=128, typed=False) def b(x, y, z=3): time.sleep(2) return x + y print(b(5, 6)) print('~' 阅读全文
posted @ 2022-02-27 23:40 ascertain 阅读(39) 评论(0) 推荐(0) 编辑
摘要: import inspect def b(x, y: int = 5, *args, z, t=55, **kwargs) -> int: return x + y signature = inspect.signature(b) print(signature) print(signature.p 阅读全文
posted @ 2022-02-27 21:32 ascertain 阅读(85) 评论(0) 推荐(0) 编辑
摘要: 打印Full binary tree: import math def reveal(vail: list | tuple): """ 利用Python居中打印 :param vail: :return: """ length = len(vail) height = math.ceil(math. 阅读全文
posted @ 2022-02-26 00:20 ascertain 阅读(30) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2022-02-26 00:04 ascertain 阅读(32) 评论(0) 推荐(0) 编辑
摘要: import datetime, multiprocessing, logging, time, threading from concurrent import futures FORMAT = '%(asctime)-9s [%(processName)-10s %(process)6d] %( 阅读全文
posted @ 2022-02-25 23:52 ascertain 阅读(48) 评论(0) 推荐(0) 编辑
摘要: import threading, time, logging, random, datetime, multiprocessing FORMAT = '%(asctime)-15s %(process)d %(lineno)-3s [%(threadName)-11s %(thread)6d] % 阅读全文
posted @ 2022-02-25 22:37 ascertain 阅读(59) 评论(0) 推荐(0) 编辑
摘要: import time, logging, typing, threading, random, datetime FORMAT = '{asctime} {levelname} {process} {processName} {threadName} {thread} {lineno}> {mes 阅读全文
posted @ 2022-02-25 21:49 ascertain 阅读(88) 评论(0) 推荐(0) 编辑
摘要: import time, logging, typing, threading, random, datetime FORMAT = '{asctime} {levelname} {process} {processName} {threadName} {thread} {message}' log 阅读全文
posted @ 2022-02-25 19:31 ascertain 阅读(69) 评论(0) 推荐(0) 编辑
摘要: 消费速度 > 生产速度 import threading, time, logging, random FORMAT = '%(asctime)-15s [%(threadName)-11s %(thread)6d] %(message)s' logging.basicConfig(format=F 阅读全文
posted @ 2022-02-25 15:52 ascertain 阅读(160) 评论(0) 推荐(0) 编辑
摘要: import threading, logging logging.basicConfig(format='%(asctime)-15s [%(threadName)s %(thread)d] %(message)s', level=logging.INFO, datefmt='%F %T') de 阅读全文
posted @ 2022-02-25 12:41 ascertain 阅读(47) 评论(0) 推荐(0) 编辑
摘要: 从上述报错,可知int类参数必须是 str, bytes, bytearray, int, float 五种类型 int() 可接受两个参数 base默认是10进制 无参 -> zero 第一参数为 number类型 TypeError 不能带明确的base, 即base就是默认10进制 可将flo 阅读全文
posted @ 2022-02-25 11:23 ascertain 阅读(1005) 评论(0) 推荐(0) 编辑
摘要: 生产杯子 import time, logging, threading FORMAT = '%(asctime)s %(threadName)s %(thread)d %(message)s' logging.basicConfig(level=logging.INFO, format=FORMA 阅读全文
posted @ 2022-02-24 22:02 ascertain 阅读(89) 评论(0) 推荐(0) 编辑
摘要: import logging FORMAT = '%(asctime)-15s\tThread: %(threadName)s %(thread)d %(message)s' logging.basicConfig(format=FORMAT, level=logging.WARNING, date 阅读全文
posted @ 2022-02-24 19:47 ascertain 阅读(23) 评论(0) 推荐(0) 编辑
上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 55 下一页