This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
中文的正则一般用 `[ \u4e00-\u9fa5]+` 即可。但对特殊字符不能完全匹配,例如:火星文、全角的字符标点符号。 | |
中文世界字符主要来自于中日韩统一表意文字(CJK Unified Ideographs),以及一些特殊的字符。大范围覆盖字符推荐用 `[ \u2E80-\uFE4F]+` 。 | |
根据Unicode5.0整理(reference [Unicode中文和特殊字符的编码范围](https://gist.github.com/shingchi/64c04e0dd2cbbfbc1350))如下: | |
1)标准CJK文字 | |
http://www.unicode.org/Public/UNIDATA/Unihan.html | |
2)全角ASCII、全角中英文标点、半宽片假名、半宽平假名、半宽韩文字母:FF00-FFEF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. 通过正则表达式检查文本内符合模式的数量 | |
```{bash} | |
<<comment | |
命令格式:awk '/<pattern>/ { <variable> ++ }; END { print <variable>};' <filepath> | |
说明:<pattern> 为正则表达式模式,<variable> 统计符合模式的变量,<filepath> 文件路径 | |
comment | |
$ awk '/\d+/ {x++} ; END { print x };' log/20200608.log | |
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python 中 id 函数实现是通过 __hash__() 方法实现。__hash__() 方法保障没个对象是可以被哈希,并且哈希值是唯一的 | |
x = object() | |
id(x) | |
hash(x) | |
# 如果要得到验证两者相关,可以将 id 函数的数据值除以一个数据值——具体数据值和平台、系统相关 | |
id(x) / 16 == hash(x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# specify the special format string | |
'{:{}{}{}.{}}'.format(2.7182818284, '>', '+', 10, 3) | |
'{:{}{sign}{}.{}}'.format(2.7182818284, '>', 10, 3, sign='+') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Category | Percentage | Survived | Dead | |
---|---|---|---|---|
Alone | 60 | 30 | 70 | |
With Parents or Children | 24 | 51 | 49 | |
With Siblings or Spouses | 32 | 47 | 53 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script src="http://dimplejs.org/dist/dimple.v2.0.0.min.js"></script> | |
<script type="text/javascript"> | |
function draw(data) { | |
// debugger; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script src="http://dimplejs.org/dist/dimple.v2.0.0.min.js"></script> | |
<script type="text/javascript"> | |
function draw(data) { | |
"use strict"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name | handedness | height | weight | avg | HR | |
---|---|---|---|---|---|---|
Tom Brown | R | 73 | 170 | 0.0 | 0 | |
Denny Lemaster | R | 73 | 182 | 0.130 | 4 | |
Joe Nolan | L | 71 | 175 | 0.263 | 27 | |
Denny Doyle | L | 69 | 175 | 0.250 | 16 | |
Jose Cardenal | R | 70 | 150 | 0.275 | 138 | |
Mike Ryan | R | 74 | 205 | 0.193 | 28 | |
Fritz Peterson | B | 72 | 185 | 0.159 | 2 | |
Dick Bertell | R | 72 | 200 | 0.250 | 10 | |
Rod Kanehl | R | 73 | 180 | 0.241 | 6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name | handedness | height | weight | avg | HR | |
---|---|---|---|---|---|---|
Tom Brown | R | 73 | 170 | 0.0 | 0 | |
Denny Lemaster | R | 73 | 182 | 0.130 | 4 | |
Joe Nolan | L | 71 | 175 | 0.263 | 27 | |
Denny Doyle | L | 69 | 175 | 0.250 | 16 | |
Jose Cardenal | R | 70 | 150 | 0.275 | 138 | |
Mike Ryan | R | 74 | 205 | 0.193 | 28 | |
Fritz Peterson | B | 72 | 185 | 0.159 | 2 | |
Dick Bertell | R | 72 | 200 | 0.250 | 10 | |
Rod Kanehl | R | 73 | 180 | 0.241 | 6 |