意大利财政代码的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 2D数组字符串或字符管理   java构建循环   java在S3桶上迭代   java通过数字id获取枚举的最佳方法   java设置水平回收视图   java使用从完整Maven项目生成的JAR安装一个模块   java背压不适用于groupBy运算符   java a4j:带有大型mp3文件的媒体输出   性能—在困难的场景中高效地对Java集合进行排序   spring Java泛型和枚举,模板参数丢失   java JavaFX HTMLEditor超链接   java Android Store变量及其在webview链接中的使用   如何在Java中实现Scala apply方法   java Lombok@Data annotation项目是否创建了任何类型的构造函数?