字符串换行连接

字符串换行连接

sql = " mainkey,vslvoykey,blno,mainblno,bkno,carrcode,carrename,bkoffcode,bkoffcname\
           ,bkcode,bkcname,rcvpcode,revpename,ldpcode,ldpename,transport \
           ,transename,dispcode,dispename,delpcode,delpename,carrtype,pccode,pcename,bktype,bachsign \
           ,secvslsign,mktcode,marketer,preload,factload,blppat,blcpat,blsignat,blsigndate,bkcount \
           ,mfcusign,mfblsign,makercode,maker,madetime,modicode,modifier,moditime,remark \
           ,blldp,bldelp,bldisp,sign,issendedi,ietype,iscuspre,prename,close_after "


cur.execute("SELECT mainkey,vslvoykey,blno,mainblno,bkno,carrcode,carrename,bkoffcode,bkoffcname "
                       + “,bkcode,bkcname,rcvpcode,revpename,ldpcode,ldpename,transport ”
                       +",transename,dispcode,dispename,delpcode,delpename,carrtype,pccode,pcename,bktype,bachsign "
                       +"FROM ECDBOOKING where MAINKEY =?",(mainkey,))
可以使用三重引号,或:

[Copy to clipboard] [ - ]
CODE:
("asf ,asf,sdf,sa,fa,fs,afs,f"
"asdfs,a,f,fsaf,sf,f,ds,"
"sfalfasld,fasf,asdf,df,")

使用括号括起来就行,中间不需要+号,在编译时会自动合并的。