0
import re
item  = '"PUBLIC".test'
re.sub(r"\b{0}\b".format(item),"(from {0} limit 0)".format(item),item)

Required result :

(from "PUBLIC".test limit 0)

Result obtained: (input item is not replaced)

"PUBLIC".test

This works if the item - > does not have quotes

import re
item  = 'PUBLIC.test'
re.sub(r"\b{0}\b".format(item),"(from {0} limit 0)".format(item),item)

Result :-> (from PUBLIC.test limit 0)

How can I get the result item to "from {item} limit 0" with maintaining the double quotes in input string item

Leo
  • 868
  • 1
  • 13
  • 32

0 Answers0