views:

62

answers:

1

I have some code in which I apply a join to a list. The list before the join looks like this:

["'DealerwebAgcy_NYK_GW_UAT'", "'DealerwebAgcy'", "'UAT'", '@ECNPhysicalMarketCo nfigId', "'GATEWAY'", "'DEALERWEB_MD_AGCY'", "'NU1MKVETC'", "'mkvetcu'", "'C:\te mp'", '0', "'NYK'", '0', '1', "'isqlw.exe'", 'GetDate()', '12345', "'NYK'", '350 ', '7']

After the join this is the resulting string

'DealerwebAgcy_NYK_GW_UAT','DealerwebAgcy','UAT',@ECNPhysicalMarketConfigId,'GAT EWAY','DEALERWEB_MD_AGCY','NU1MKVETC','mkvetcu','C: emp',0,'NYK',0,1,'isqlw. exe',GetDate(),12345,'NYK',350,7

Note the element 'C:\temp' which ends up as ,'C: emp',

I tried something similar on the python command prompt , but I wasn't able to 2 repeat this.

the relevant code responsible for this magic is as follows.

values_dict["ECNMarketInstance"]  = [strVal(self.EcnInstance_),strVal      (self.DisplayName_) ,strVal(self.environment_), '@ECNPhysicalMarketConfigId',strVal(self.EcnGatewaTypeId_),strVal(self.ConnectionComponent_),strVal(self.UserName_),strVal(self.Password_),strVal(self.WorkingDir_),"0",strVal(self.region_),"0","1", strVal(self.LUVersion_), "GetDate()" ,  self.LUUserId_,strVal(self.LUOwningSite_),self.QuoteColumnId_ , self.Capabilities_]

delim = ","
joined = delim.join(values) 
print values
print joined
+5  A: 

\t is a tab character.

You have two options: 1) make the string be "c:\\temp", or 2) use r"c:\temp"

Ned Batchelder