String concat across multiple source code lines

Carsten Gaebler cg at schlund.de
Wed Aug 2 16:31:46 EDT 2000


Try this:

sql = "SELECT * FROM TABLE "+\
      "WHERE TABLE.COL = VAR "+\
      "GROUP BY COL2"

Carsten.


Matt wrote:
> 
> Is there a better way to do the following?:
> 
> sql = "SELECT * FROM TABLE"
> sql = sql + "WHERE TABLE.COL = VAR"
> sql = sql + "GROUP BY COL2"
> 
> I would prefer a 'cleaner' way of concatinating a single string across
> multiple program code lines. When using a triple quote, any indentation
> in the code gets included.



More information about the Python-list mailing list