目录 | 上一节 (1.6 文件) | 下一节 (2.0 处理数据) 1.7 函数 随着程序开始变大,我们会想要有条理地组织这些程序。本节简要介绍函数、库模块以及带有异常的错误处理。 自定义函数 对你要重用的代码使用函数。下面是函数的定义方式: def sumcount(n): ''' Return ...
分类:
编程语言 时间:
2021-02-20 12:06:51
阅读次数:
0
线上有一个消息消费服务,主线程批量从kafka拉取消息,然后提交到子线程池中挨个消费。分布式追踪用到的kafka插件会使子线程创建的ThreadLocalScope被循环引用,从而造成内存泄漏。 ...
分类:
其他好文 时间:
2021-02-20 11:53:15
阅读次数:
0
一、队列(Queue) Python的Queue模块中提供了同步的、线程安全的队列类,包括FIFO(先入先出)队列Queue,LIFO(后入先出)队列LifoQueue,和优先级队列PriorityQueue。这些队列都实现了锁原语,能够在多线程中直接使用。可以使用队列来实现线程间的同步。 常用方法 ...
分类:
编程语言 时间:
2021-02-19 13:37:25
阅读次数:
0
0 引言 本文将常用的指令记录下来,以备查询。 1 git Command Meaning Reference Linking git status view all files' state, tracked or untracked, commited or un commited git st ...
分类:
系统相关 时间:
2021-02-19 13:10:17
阅读次数:
0
react基础一 1. 组件三大属性 state state 为组件的内部数据。类似 vue 中的 data; 注意:状态必须通过 setState进行更新。更新是合并,而不是替换。更新状态有两种方式。 // 对象方式 this.setState({ count: this.state.count ...
分类:
其他好文 时间:
2021-02-18 13:31:01
阅读次数:
0
/** * 方法一:使用indexOf和subString方法,循环判断并截取 */ public static void getStrCount1(String str, String con) { int count = 0; while (str.indexOf(con) >= 0) { // ...
分类:
编程语言 时间:
2021-02-17 14:46:16
阅读次数:
0
We are given a matrix with rows and columns has cells with integer coordinates , where?`0 这道题给了一个R行C列的矩阵,又给了一个起始点 (r0, c0),让按照离起始点的曼哈顿距离从小到大排序坐标点。博主最先 ...
分类:
其他好文 时间:
2021-02-17 14:32:03
阅读次数:
0
注意不满$4$位的话要补成$4$位。 string s; set<int> S; int main() { cin>>s; while(s.size()<4) s='0'+s; while(true) { sort(s.begin(),s.end(),greater<char>()); string ...
分类:
其他好文 时间:
2021-02-15 12:21:49
阅读次数:
0
struct drm_mode_config 模式配置控制结构体。 定义 struct drm_mode_config { struct mutex mutex; struct drm_modeset_lock connection_mutex; struct drm_modeset_acquire ...
分类:
其他好文 时间:
2021-02-15 12:16:04
阅读次数:
0
https://www.acwing.com/problem/content/1133/ #include <bits/stdc++.h> using namespace std; #define IO ios::sync_with_stdio(false);cin.tie(0); cout.tie ...
分类:
其他好文 时间:
2021-02-15 11:53:38
阅读次数:
0