意大利财政代码的python库(codicefiscale)

codicefiscale的Python项目详细描述


意大利财政代码的python库

CodiceFiscale是一个用于处理意大利财政代码的Python库 官方称为意大利的科迪丝·菲斯卡尔。

版权所有(c)2009-2016 Emanuele Rocca

主页:https://github.com/ema/pycodicefiscale

这个库是免费软件;您可以重新分发它和/或 根据GNU小公众条款修改 自由软件基金会发布的许可证;或者 许可证的2.1版,或(由您选择)任何更高版本。

这个图书馆的发行是希望它能有用, 但没有任何保证;甚至没有 适销性或适合某一特定目的的适销性。看GNU 更详细的信息,请参阅较低的通用公共许可证。

你应该收到一份GNU的副本 与此库一起使用许可证;如果没有,请写入免费软件 美国马萨诸塞州波士顿市富兰克林街51号基金会,邮编:02110-1301

CodiceFiscale模块文档

一个简单的例子

>>> import datetime
>>> from codicefiscale import build
>>>
>>> build('Rocca', 'Emanuele', datetime.datetime(1983, 11, 18), 'M', 'D969')
'RCCMNL83S18D969H'

模块内容

build(surname, name, birthday, sex, municipality) -> string

Computes the fiscal code for the given person data.

eg: build(‘Rocca’, ‘Emanuele’, datetime.datetime(1983, 11, 18), ‘M’, ‘D969’)
-> RCCMNL83S18D969H

control_code(input_string) -> int

Computes the control code for the given input_string string. The expected input_string is the first 15 characters of a fiscal code.

eg: control_code(‘RCCMNL83S18D969’) -> ‘H’

get_birthday(code) -> string

Birthday of the person whose fiscal code is ‘code’, in the format DD-MM-YY.

Unfortunately it’s not possible to guess the four digit birth year, given that the Italian fiscal code uses only the last two digits (1983 -> 83). Therefore, this function returns a string and not a datetime object.

eg: birthday(‘RCCMNL83S18D969H’) -> 18-11-83

get_sex(code) -> string

The sex of the person whose fiscal code is ‘code’.

eg: sex(‘RCCMNL83S18D969H’) -> ‘M’
sex(‘CNTCHR83T41D969D’) -> ‘F’

isvalid(code) -> bool

This function checks if the given fiscal code is syntactically valid.

eg: isvalid(‘RCCMNL83S18D969H’) -> True
isvalid(‘RCCMNL83S18D969’) -> False

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java EclipseLink级联持久化异常   java Android Studio本地库模块问题   java更新值Netbeans   java从消息数组中返回一条消息   java Struts标记:一个jsp中有多个寻呼机   java如何访问hibernate。cfg。xml,config。属性和log4j。来自项目文件夹外部的属性   JavaSpringPetCare示例,控制器操作如何链接到jsp的?   java理解try&catch和错误处理   javascript如何将数据从动态表存储到数据库   使用JAVA比较不同格式的值   java如何在返回服务时设置下拉列表的默认值?   java将oracle十六进制字符串转换为实际字符串值   java jpa子图和MappedSuperclass抛出未知实体   用Java实现swing自定义Matlab按钮外观   随机掷骰的java百分比数学结果不正确   java创建了文件路径,但照片无法保存,我一直在抓拍   java如何确保要使用的端口始终可用(即未使用)?   xsd如何用java生成JAXBC类。util。可选择的   java更改JOptionPane中的按钮布局。showOptionDialog()