This software is a Python library designed for the purpose of generating Italian fiscal codes. It enables developers to easily integrate and utilize fiscal codes in their projects, providing a fast and convenient solution for businesses operating in Italy.
> import datetime
> from codicefiscale import build
> build('Rocca', 'Emanuele', datetime.datetime(1983, 11, 18), 'M', 'D969')
> 'RCCMNL83S18D969H'
CodiceFiscale comes with four main functions that you can utilize:
build(surname, name, birthday, sex, municipality) -> string: Computes the fiscal code for a person given their data. An example usage is:
> 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. Example usage is:
> control_code('RCCMNL83S18D969')
> 'H'
get_birthday(code) -> string: Returns the birthday of the person whose fiscal code is 'code' in the format DD-MM-YY. However, it is 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 instead of a datetime object. Example usage is:
> birthday('RCCMNL83S18D969H')
> 18-11-83
get_sex(code) -> string: Returns the sex of the person whose fiscal code is 'code'. Example usage is:
> sex('RCCMNL83S18D969H')
> 'M'
> sex('CNTCHR83T41D969D')
> 'F'
isvalid(code) -> bool: Checks if the given fiscal code is syntactically valid. Example usage is:
> isvalid('RCCMNL83S18D969H')
> True
> isvalid('RCCMNL83S18D969')
> False
Overall, CodiceFiscale is a useful library for any Python developer who needs to work with Italian fiscal code numbers. It's easy to use and saves time by automating computation tasks.
Version 0.4: N/A