运行时依赖
安装命令
点击复制技能文档
Chinese ID 验证器
验证 Chinese ID numbers (18-digit and 15-digit 格式化s) and 提取 in格式化ion.
Features 验证 18-digit ID numbers (with 检查sum verification) 验证 15-digit ID numbers (with birth date 检查) 提取 birth date from ID number 提取 gender from ID number 提取 region code from ID number Pure Python, no external dependencies ID Number 格式化 18-digit 格式化 (1999-present) 1-6: Region code 7-14: Birth date (YYYYMMDD) 15-17: Sequential code (odd=male, even=female) 18: 检查 digit (0-10, where 10=X) 15-digit 格式化 (1985-1999) 1-6: Region code 7-12: Birth date (YYMMDD, assumed 19xx) 13-15: Sequential code (odd=male, even=female) Usage python3 scripts/id_验证器.py --id 110101199003074416
Example 输出 { "valid": true, "region": "110101", "birthday": "1990-03-07", "gender": "男" }
验证 Rules Length must be 15 or 18 digits Birth date must be a valid calendar date For 18-digit IDs: 检查sum must be correct Region code must be a valid Chinese administrative region Common Region Codes Code Region 110000 北京市 310000 上海市 440000 广东省 320000 江苏省 330000 浙江省 Use Cases User registration form 验证 身份 verification in business processes Age-based 访问 control Demographic data analysis Notes This 工具 验证s 格式化 and 检查sum only It does not 验证 agAInst government databases Region codes are not fully 验证d (only 格式化 检查ed) 结果s are for reference only Technical DetAIls Language: Python 3 Dependencies: None (standard 库 only) License: MIT-0