Spaces from string specifier

Gavin Tomlins gavin at madzag.com
Fri Sep 14 06:57:43 CEST 2007


Greetings all,

 

I'm trying to work out when using a format specifier I get spaces in the
resulting string.  Eg. Looking at the outputted string you can see that
there are spaces after T5LAT, F4LAT etc. as I result from trying to keep the
code aligned 

 

Does anyone have any insights in how to prevent this ? 

 

Regards

 

Gavin

 

--- Code Fragment ---

 

fmtSqlP300Amp = 'UPDATE Patient SET  \

                O2AMP = "%s", O1AMP = "%s", OzAMP = "%s", PzAMP = "%s",
P4AMP = "%s", CP4AMP = "%s", T6AMP = "%s", C4AMP = "%s", TP8AMP = "%s",
T4AMP = "%s", T5AMP = "%s", P3AMP = "%s", \

                CP3AMP = "%s", CPzAMP = "%s", CzAMP = "%s", FC4AMP = "%s",
FT8AMP = "%s", TP7AMP = "%s", C3AMP = "%s", FCzAMP = "%s", FzAMP = "%s",
F4AMP = "%s", F8AMP = "%s", \

                T3AMP = "%s", FT7AMP = "%s", FC3AMP = "%s", F3AMP = "%s",
FP2AMP = "%s", F7AMP = "%s", FP1AMP = "%s" \

                WHERE Pat_Id = "%s;"'

 

sqlAmpString = fmtSqlP300Amp % (
self.ERPAmpSites[O2],self.ERPAmpSites[O1],self.ERPAmpSites[Oz],self.ERPAmpSi
tes[Pz],self.ERPAmpSites[P4],self.ERPAmpSites[CP4],self.ERPAmpSites[T6], \

 
self.ERPAmpSites[C4],self.ERPAmpSites[TP8],self.ERPAmpSites[T4],self.ERPAmpS
ites[T5],self.ERPAmpSites[P3],self.ERPAmpSites[CP3], \

 
self.ERPAmpSites[CPz],self.ERPAmpSites[Cz],self.ERPAmpSites[FC4],self.ERPAmp
Sites[FT8],self.ERPAmpSites[TP7],self.ERPAmpSites[C3], \

 
self.ERPAmpSites[FCz],self.ERPAmpSites[Fz],self.ERPAmpSites[F4],self.ERPAmpS
ites[F8],self.ERPAmpSites[T3],self.ERPAmpSites[FT7], \

 
self.ERPAmpSites[FC3],self.ERPAmpSites[F3],self.ERPAmpSites[FP2],self.ERPAmp
Sites[F7],self.ERPAmpSites[FP1], self.ERPPatId)

 

 

print sqlAmpString

--- Output ---

....................................................

sqlAmpString

....................................................

UPDATE Patient SET                  O2AMP = "2.43119", O1AMP = "2.77413",
OzAMP = "2.47781", PzAMP = "2.50786", P4AMP = "4.579", CP4AMP = "3.50302",
T6AMP = "9.55172", C4AMP = "1.21119", TP8AMP = "5.6498", T4AMP = "1.29149",
T5AMP = "0.565705", P3AMP = "-0.957866",                 CP3AMP =
"-0.231566", CPzAMP = "0.970299", CzAMP = "-0.214471", FC4AMP = "-0.607667",
FT8AMP = "-0.226904", TP7AMP = "-1.51269", C3AMP = "-1.26248", FCzAMP =
"-1.61319", FzAMP = "-2.55086", F4AMP = "-1.87688", F8AMP = "-1.11846",
T3AMP = "-1.98619", FT7AMP = "-2.0613", FC3AMP = "-1.8458", F3AMP =
"-2.23433", FP2AMP = "-2.01364", F7AMP = "-1.80539", FP1AMP = "-2.00328"
WHERE Pat_Id = "GT0001;"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070914/f097a64a/attachment.html>


More information about the Python-list mailing list