On Wed, May 23, 2018 at 1:45 PM, MRAB <pyt...@mrabarnett.plus.com> wrote:
> On 2018-05-23 19:36, Mikhail V wrote: > >> On Wed, May 23, 2018 at 8:08 PM, Mikhail V <mikhail...@gmail.com> wrote: >> >>> On Wed, May 23, 2018 at 4:19 PM, Dan Strohl <d.str...@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(): >>> foobar >>> data = /// s2 >>> first line >>> last line >>> foobar >>> >>> 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: > > def func(): > foobar > data = >> : > first line > last line > foobar > > 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 > line\nlast line\n'. > > If you want additional indentation, then provide a string literal: > > def func(): > foobar > data = >> ' ': > first line > last line > foobar > > for ' first line\n last line\n' or: > > def func(): > foobar > data = >> '\t': > first line > last line > foobar > > for '\tfirst line\n\tlast line\n'. > -- > https://mail.python.org/mailman/listinfo/python-list > I think this is getting way too complex to fix a problem which doesn't exist. -- **** Listen to my FREE CD at http://www.mellowood.ca/music/cedars **** Bob van der Poel ** Wynndel, British Columbia, CANADA ** EMAIL: b...@mellowood.ca WWW: http://www.mellowood.ca -- https://mail.python.org/mailman/listinfo/python-list