This repository has been archived by the owner on Jul 14, 2020. It is now read-only.
forked from nobodxbodon/vscode_Chinese_Input_Assistant
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
27959f8
commit 2e3cb75
Showing
3 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"出现次数": { | ||
"prefix": [ | ||
"array", | ||
"ChuXianCiShu", | ||
"出现次数" | ||
], | ||
"body": [ | ||
"const 统计出现次数 = (数组, 值) => 数组.reduce((次数, 项) => (项 === 值 ? 次数 + 1 : 次数), 0);", | ||
"统计出现次数(${1:数组}, ${2:值});" | ||
], | ||
"description": "统计数组中某个值出现的次数" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"读文件": { | ||
"prefix": [ | ||
"file", | ||
"WenJian", | ||
"读文件" | ||
], | ||
"body": [ | ||
"with open(${1:文件全路径}) as 文件:", | ||
"\t内容 = 文件.read()" | ||
], | ||
"description": "读取某文件" | ||
}, | ||
"读所有文件": { | ||
"prefix": [ | ||
"file", | ||
"WenJian", | ||
"读所有文件" | ||
], | ||
"body": [ | ||
"import os", | ||
"路径 = '.'", | ||
"for 文件名 in os.listdir(路径):", | ||
"\twith open(os.path.join(路径, 文件名)) as 文件:", | ||
"\t\t内容 = 文件.read()" | ||
], | ||
"description": "读取某目录下所有文件" | ||
} | ||
} |