意大利财政代码的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接口中的每个方法都是抽象的,但在抽象类中,我们也只能使用抽象方法   初始化Java中声明的、未初始化的变量会发生什么情况?   java BouncyCastle openPGP将字节[]数组加密为csv文件   在Java中将类A(和所有子类)映射到类B的实例的字典   RSA公钥编码,在Java和Android中,代码相同,结果不同   java在安卓中实现数字检测语音识别   java取消选择复选框   java如何在其他配置中重用Maven配置XML片段   java有没有一种有效的方法来检查HashMap是否包含映射到相同值的键?   spring处理程序调度失败;嵌套的例外是java。lang.NoClassDefFoundError:org/apache/http/client/HttpClient   带有ehcache的java多层缓存   java如何访问chromium(或任何其他浏览器)cookie   java通过将两个集合与spring data mongodb data中的条件合并来获取计数   安卓中R.java的语法错误