Indented multi-line strings
On 2018-05-23 19:36, Mikhail V wrote:
> On Wed, May 23, 2018 at 8:08 PM, Mikhail V <mikhailwas at gmail.com> wrote:
>> On Wed, May 23, 2018 at 4:19 PM, Dan Strohl <D.Strohl at f5.com> wrote:
>> data = /// sN # and
>> data = /// tN
>> Where N - is the amount of characters, spaces (s) or
>> tabs (t).
>> This should cover most use cases.
>> It implies of course that the user should know himself
>> what he is doing.
>> More concrete example:
>> def func():
>> data = /// s2
>> first line
>> last line
>> will store same data as:
>> data = "first linelast line"
> oops, I meant it to be:
> data = "first line\nlast line"
> sorry for possible confusion
>> (assuming of course no trailing spaces were
>> in original lines)
Instead of the "s2", etc:
data = >> :
Leading indentation to the level of the first line would be stripped.
As the last line also ends with '\n', the result should be 'first
If you want additional indentation, then provide a string literal:
data = >> ' ':
for ' first line\n last line\n' or:
data = >> '\t':
for '\tfirst line\n\tlast line\n'.