Issue with python string join.

Posted by Pradyot on Stack Overflow See other posts from Stack Overflow or by Pradyot
Published on 2010-04-29T21:05:59Z Indexed on 2010/04/29 21:07 UTC
Read the original article Hit count: 355

Filed under:

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

© Stack Overflow or respective owner

Related posts about python