-2

I have a string

S= "SD,HG,FG,LM"

I would like to convert this to a single quotes for each element?

S = 'SD','HG','FG','LM'

I need this way because i get some configurations from a json which is in double quotes and I would like to format it in the required manner to pass it onto a where clause in a select query in sql

"""SELECT * FROM TABLE WHERE COLUMN_NAME IN ({X});""" .format(X = S)

Manak
  • 27
  • 2
  • 8

1 Answers1

0

try inbuilt function split() to get desired output.

s= S.split(',')
print(s)
Juhi Dhameliya
  • 170
  • 2
  • 9