how to convert 123456,123456,B-CAT to '123456','123456','B-CAT' in python -


by using query

select group_concat(productid) blog_txstock lastupdateon between  ('2016-05-01 00:00:00') , ('2016-05-09 00:00:00'); 

i getting result like

123456,123456,b-cat 

but want convert result in to

'123456','123456','b-cat' 

you need change outer quotes:

>>> s = '123456,123456,b-cat' >>> ",".join("'{0}'".format(i) in s.split(',')) "'123456','123456','b-cat'" 

in case wondering why showing " " that's way represented, if save resulting value , print it, result want.

>>> r = ",".join("'{0}'".format(i) in s.split(',')) >>> print(r) '123456','123456','b-cat' 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -