lists.arthurdejong.org
RSS feed

Re: Very Basic Question

[Date Prev][Date Next] [Thread Prev][Thread Next]

Re: Very Basic Question



On Mon, 2022-05-23 at 13:13 +0000, Simao Coimbra wrote:
> I managed to install and run the first example from the
> documentation, but now I don't know how to run the other modules. I
> have tried several versions but always get an error.

You have to import the module and use the function from the imported
namespace.

For example:

    from stdnum.pl import nip
    nip.validate('PL8921489098')

Or

    from stdnum import vatin
    vatin.validate('PL8921489098')

It is also possible to import the module like so:

    import stdnum.pl.nip
    stdnum.pl.nip.validate('PL8921489098')

and even:

    from stdnum.pl.nip import validate
    validate('PL8921489098')

(the last form has the downside that it is more difficult to import
multiple validate functions)

Hope this helps a bit,

-- 
-- arthur - arthur@arthurdejong.org - https://arthurdejong.org/ --