Re: ConfigParser: use newline in INI file

2019-03-07 Thread Tim Chase
On 2019-03-07 17:19, tony wrote: > Python 3.5.3 (default, Sep 27 2018, 17:25:39) > >>> "a\\nb".decode("string-escape") > Traceback (most recent call last): > File "", line 1, in > AttributeError: 'str' object has no attribute 'decode' Looks like bytestring.decode('unicode_escape') does what

Re: ConfigParser: use newline in INI file

2019-03-07 Thread jim . womeldorf
On Thursday, March 7, 2019 at 10:38:03 AM UTC-6, jim.wo...@gmail.com wrote: > On Saturday, October 1, 2016 at 9:57:24 AM UTC-5, Thorsten Kampe wrote: > > Hi, > > > > ConfigParser escapes `\n` in ini values as `\\n`. Is there a way to > > signal to ConfigParser that there is a line break? > > >

Re: ConfigParser: use newline in INI file

2019-03-07 Thread jim . womeldorf
On Saturday, October 1, 2016 at 9:57:24 AM UTC-5, Thorsten Kampe wrote: > Hi, > > ConfigParser escapes `\n` in ini values as `\\n`. Is there a way to > signal to ConfigParser that there is a line break? > > Thorsten And now we know! I think they should have named Python 3 something else --

Re: ConfigParser: use newline in INI file

2019-03-07 Thread tony
On 07/03/2019 16:58, jim.womeld...@gmail.com wrote: > On Thursday, March 7, 2019 at 8:55:31 AM UTC-6, tony wrote: >> On 07/03/2019 14:16, jim.womeld...@gmail.com wrote: >>> On Saturday, October 1, 2016 at 7:41:40 PM UTC-5, Ned Batchelder wrote: On Saturday, October 1, 2016 at 6:25:16 PM

Re: ConfigParser: use newline in INI file

2019-03-07 Thread Peter Otten
tony wrote: >> On Saturday, October 1, 2016 at 7:41:40 PM UTC-5, Ned Batchelder wrote: >>> If you want to have \n mean a newline in your config file, you can >>> do the conversion after you read the value: >>> >>> >>> "a\\nb".decode("string-escape") >>> 'a\nb' > How does that translate

Re: ConfigParser: use newline in INI file

2019-03-07 Thread jim . womeldorf
On Thursday, March 7, 2019 at 8:55:31 AM UTC-6, tony wrote: > On 07/03/2019 14:16, jim.womeld...@gmail.com wrote: > > On Saturday, October 1, 2016 at 7:41:40 PM UTC-5, Ned Batchelder wrote: > >> On Saturday, October 1, 2016 at 6:25:16 PM UTC-4, Thorsten Kampe wrote: > >>> * Ben Finney (Sun, 02 Oct

Re: ConfigParser: use newline in INI file

2019-03-07 Thread tony
On 07/03/2019 14:16, jim.womeld...@gmail.com wrote: > On Saturday, October 1, 2016 at 7:41:40 PM UTC-5, Ned Batchelder wrote: >> On Saturday, October 1, 2016 at 6:25:16 PM UTC-4, Thorsten Kampe wrote: >>> * Ben Finney (Sun, 02 Oct 2016 07:12:46 +1100) Thorsten Kampe writes: >

Re: ConfigParser: use newline in INI file

2019-03-07 Thread jim . womeldorf
On Saturday, October 1, 2016 at 7:41:40 PM UTC-5, Ned Batchelder wrote: > On Saturday, October 1, 2016 at 6:25:16 PM UTC-4, Thorsten Kampe wrote: > > * Ben Finney (Sun, 02 Oct 2016 07:12:46 +1100) > > > > > > Thorsten Kampe writes: > > > > > > > ConfigParser escapes `\n` in ini values as `\\n`.

Re: ConfigParser: use newline in INI file

2016-10-02 Thread Peter Otten
Thorsten Kampe wrote: > * Ned Batchelder (Sat, 1 Oct 2016 17:41:28 -0700 (PDT)) >> If you want to have \n mean a newline in your config file, you can >> do the conversion after you read the value: >> >> >>> "a\\nb".decode("string-escape") >> 'a\nb' > > Interesting approach (although it

Re: ConfigParser: use newline in INI file

2016-10-02 Thread Chris Angelico
On Sun, Oct 2, 2016 at 9:34 PM, Thorsten Kampe wrote: >> If you want to have \n mean a newline in your config file, you can >> do the conversion after you read the value: >> >> >>> "a\\nb".decode("string-escape") >> 'a\nb' > > Interesting approach (although it

Re: ConfigParser: use newline in INI file

2016-10-02 Thread Thorsten Kampe
* Ned Batchelder (Sat, 1 Oct 2016 17:41:28 -0700 (PDT)) > > On Saturday, October 1, 2016 at 6:25:16 PM UTC-4, Thorsten Kampe wrote: > > * Ben Finney (Sun, 02 Oct 2016 07:12:46 +1100) > > > > > > Thorsten Kampe writes: > > > > > > > ConfigParser escapes `\n` in ini

Re: ConfigParser: use newline in INI file

2016-10-01 Thread Ned Batchelder
On Saturday, October 1, 2016 at 6:25:16 PM UTC-4, Thorsten Kampe wrote: > * Ben Finney (Sun, 02 Oct 2016 07:12:46 +1100) > > > > Thorsten Kampe writes: > > > > > ConfigParser escapes `\n` in ini values as `\\n`. > > Indenting solves the problem. I'd rather keep it

Re: ConfigParser: use newline in INI file

2016-10-01 Thread Thorsten Kampe
* Ben Finney (Sun, 02 Oct 2016 07:12:46 +1100) > > Thorsten Kampe writes: > > > ConfigParser escapes `\n` in ini values as `\\n`. Indenting solves the problem. I'd rather keep it one line per value but it solves the problem. Thorsten --

Re: ConfigParser: use newline in INI file

2016-10-01 Thread Thorsten Kampe
* Terry Reedy (Sat, 1 Oct 2016 15:44:39 -0400) > > On 10/1/2016 10:56 AM, Thorsten Kampe wrote: > > > ConfigParser escapes `\n` in ini values as `\\n`. Is there a way to > > signal to ConfigParser that there is a line break? > > Without an example or two, I don't really understand the question

Re: ConfigParser: use newline in INI file

2016-10-01 Thread Ben Finney
Thorsten Kampe writes: > ConfigParser escapes `\n` in ini values as `\\n`. How do you demonstrate that? Here is an example text of a config file:: >>> import io >>> import textwrap >>> config_text = textwrap.dedent(r""" ... [foo] ...

Re: ConfigParser: use newline in INI file

2016-10-01 Thread Terry Reedy
On 10/1/2016 10:56 AM, Thorsten Kampe wrote: ConfigParser escapes `\n` in ini values as `\\n`. Is there a way to signal to ConfigParser that there is a line break? Without an example or two, I don't really understand the question enough to answer. -- Terry Jan Reedy --

ConfigParser: use newline in INI file

2016-10-01 Thread Thorsten Kampe
Hi, ConfigParser escapes `\n` in ini values as `\\n`. Is there a way to signal to ConfigParser that there is a line break? Thorsten -- https://mail.python.org/mailman/listinfo/python-list