[Zope] Python formatting question
J Cameron Cooper
zope-l at jcameroncooper.com
Thu Jul 21 12:41:50 EDT 2005
hpinson at indepthl.com wrote:
> In a Python script, how can I break up a SQL statement over more than
> one line? For example, to transform
>
> #generate the sql statement
> sql="DELETE FROM tblUsers WHERE user_name LIKE '%'"
>
> to:
>
> #generate the sql statement
> sql="DELETE FROM tblUsers WHERE user_name LIKE '%'"
>
> ...does not work. Is there a way to break lines?
>
> Any example would be appreciated.
Python allows you to you triple-quotes to include line breaks in the
string::
sql="""DELETE FROM tblUsers
WHERE user_name LIKE '%'"""
Take a look at the python.org tutorial or diveintopython.org.
--jcc
More information about the Zope
mailing list