try..except or type() or isinstance()?

Alexa Oña alexandra_mel.1981 at hotmail.es
Sun Aug 16 10:08:11 EDT 2020


Sorry... i have received a lot of messages from python support and I still didn’t understand how to fix it

Obtener Outlook para iOS<https://aka.ms/o0ukef>
________________________________
De: Python-list <python-list-bounces+alexandra_mel.1981=hotmail.es at python.org> en nombre de Manfred Lotz <ml_news at posteo.de>
Enviado: Sunday, August 16, 2020 9:48:07 AM
Para: python-list at python.org <python-list at python.org>
Asunto: Re: try..except or type() or isinstance()?

On Sun, 16 Aug 2020 09:40:12 +0200
Manfred Lotz <ml_news at posteo.de> wrote:

> On Sat, 15 Aug 2020 12:20:48 -0400
> Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
>
> > On Sat, 15 Aug 2020 15:31:56 +0200, Manfred Lotz <ml_news at posteo.de>
> > declaimed the following:
> >
> > >On Sat, 15 Aug 2020 11:47:03 +0200
> > >Sibylle Koczian <nulla.epistola at web.de> wrote:
> > >
> >
> > >> if the value comes from a file, isn't it a
> > >> string in any case? A string that may be convertible to int or
> > >> not? Or what sort of file do I overlook?
> > >>
> > >
> > >In this case it is a TOML file.
> >
> >      Based on https://en.wikipedia.org/wiki/TOML this means you
> > need a parser...
> > """
> > In TOML the syntax determines the data types ("syntax typing")
> > """
> >
> >      String data is surrounded with " marks, numbers are not
> > (though the example doesn't show if integers are treated differently
> > from floating point), arrays/lists in [] with embedded comma ([] are
> > also overloaded for section headers, with subsections using
> > section.subsection naming), dates are some ugly creation, and looks
> > like true/false are reserved values.
> >
> >      However, as pointed out -- all data read from the file will
> > be seen as a Python string data type. It is only after determining
> > the TOML data type -- by examining the string itself -- that one can
> > convert to internal format.
> >
> >      Unfortunately, TOML is not compatible with INI -- for which
> > Python already has a read/write module. But there is
> > https://pypi.org/project/toml/
> > (uses the same example file as Wikipedia) -- latest version was from
> > May.
> >
> >
>
> I use tomlkit as the toml package doesn't support quoted keys
> sufficiently.
>

Just checked again. It seems I was wrong. Both toml and tomlkit do
support quoted keys ok.

--
Manfred

--
https://mail.python.org/mailman/listinfo/python-list


More information about the Python-list mailing list