Re: Very Basic Question
[Date Prev][Date Next] [Thread Prev][Thread Next]Re: Very Basic Question
- From: Denis Rouleau <denis.rouleau [at] gmail.com>
- To: Arthur de Jong <arthur [at] arthurdejong.org>
- Cc: python-stdnum-users [at] lists.arthurdejong.org, Simao Coimbra <simao.coimbra [at] basf.com>
- Subject: Re: Very Basic Question
- Date: Wed, 25 May 2022 16:50:31 -0400
Late to the party.
I don't think you need to import stdnum.pl,
Just stdnum
That's what the second error message implies.
Le mar. 24 mai 2022, 14 h 16, Arthur de Jong <arthur [at] arthurdejong.org> a écrit :
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 [at] arthurdejong.org - https://arthurdejong.org/ --
- Very Basic Question,
Simao Coimbra
- Re: Very Basic Question,
Arthur de Jong
- Re: Very Basic Question, Denis Rouleau
- RE: [EXT] Re: Very Basic Question, Simao Coimbra
- Re: Very Basic Question,
Arthur de Jong
- Prev by Date: Re: Very Basic Question
- Next by Date: RE: [EXT] Re: Very Basic Question
- Previous by thread: Re: Very Basic Question
- Next by thread: RE: [EXT] Re: Very Basic Question