How can I make import libraries, for example, I was searching and found Babel to do internationalization of dates, but I do not know how to import this library?
How can I make import libraries, for example, I was searching and found Babel to do internationalization of dates, but I do not know how to import this library?
I do not think you're talking about the installation. You have the documentation .
The default for importing in code is this:
from babel import *
This will import any Babel library. But you can choose just what matters:
from babel import Locale
Or you can import multiple members. And you can do it through a sub-module:
from babel.dates import format_date, format_datetime, format_time
In this case dates
is a sub-module within the module babel
.
All this I got on documentation . I think it's the best way to learn how to use the library.
If you want to study the Python module system at documentation is here . And about import .
Do with the reserved word import
or from modulo import Classe
. for example:
>>> from datetime import datetime
>>> datetime.now()
datetime.datetime(2015, 8, 6, 21, 57, 23, 947736)
>>> import os
>>> os.name
'posix'
See official documentation for python
In the case of Babel, the library page has an example
>>> from babel.dates import format_datetime
>>> print format_datetime(locale='ru_RU')
26 июля 2013 г., 15:48:18