On Thu, May 21, 2015 at 12:24 PM, Rich Shepard <[email protected]> wrote: > On Thu, 21 May 2015, Luciano Ramalho wrote: >> - Two or more string literals with no intervening tokens except >> whitespace are parsed as a single string literal. > > > Unless the string is delineated with single quotes (as in a content list > for a drop-down picklist control). :-)
The syntax I described works for any of the valid string delimiters in Python: single quotes, double quotes, triple single quotes and triple double quotes, and the adjacent string literals do not need to use the same delimiter, you can mix and match and they'll still be parsed as one big string literal. > I'm used to seeing (and writing) newlines in bash scripts and other text > so now I know python recognizes it I can use this solution. The problem with the trailing "\" is if someone accidentally types a space after it, the newline is no longer escaped, and most editors don't highlight this error, so you get a confusing message from the interpreter. Best, Luciano > > Much appreciated, > > > Rich > _______________________________________________ > Portland mailing list > [email protected] > https://mail.python.org/mailman/listinfo/portland -- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/0636920032519.do | Professor em: http://python.pro.br | Twitter: @ramalhoorg _______________________________________________ Portland mailing list [email protected] https://mail.python.org/mailman/listinfo/portland
