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
Post a Comment