擅长:python、mysql、java
<p>@robert很擅长用<code>format()</code>来表示字符串。
连接字符串的另一种方法是:</p>
<pre><code>s = ('select count(*)'
'from ept_inv e'
'where e.ept_type = {device_type}'
'and e.inv_id = {endpoint_id};')
sql_statement = sql_statement_format.format(
device_type=in_row[cs.DeviceType],
endpoint_id=in_row[cs.EndpointId])
</code></pre>
<p>实际上,在Python中,使用这样的括号比通过<code>\</code>截断行更可取。你知道吗</p>