Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions script_library/index.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"format_version": 1,
"data_version": 88,
"updated": "2026-04-11T21:12:50.787Z",
"data_version": 89,
"updated": "2026-04-12T05:10:38Z",
"announcement": null,
"categories": [
{
Expand Down Expand Up @@ -1490,6 +1490,30 @@
"updated": null,
"status": "active",
"lines": 236
},
{
"id": "community_身份证核验__by_霞飞路",
"name": "身份证核验 — by 霞飞路",
"name_en": "身份证核验 — by 霞飞路",
"desc": "[投稿] 身份证核验 — by 霞飞路",
"desc_en": "[投稿] 身份证核验 — by 霞飞路",
"category": "basic",
"file": "scripts/basic/script_mnul4nuo.py",
"thumbnail": null,
"version": 1,
"file_type": "py",
"author": "社区投稿",
"author_en": "社区投稿",
"tags": [
"community",
"basic"
],
"requires": [],
"min_app_version": "1.5.0",
"added": "2026-04-12",
"updated": null,
"status": "active",
"lines": 17
}
]
}
17 changes: 17 additions & 0 deletions script_library/scripts/basic/script_mnul4nuo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import re
def check_id_card(id_str):
if len(id_str) != 18 : return False
last = id_str[17].upper()
if not (last.isdigit() or last == 'X') : return False
try:
if not re.search(r"^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$",id_str).group():pass
except:
return False
weights = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]
codes = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2']
total = sum(int(id_str[i]) * weights[i] for i in range(17))
mod = total % 11
expected = codes[mod]
return last == expected
if __name__ == "__main__":
print(check_id_card(input("输入18位完整sfz号码:")))
Loading