For example:
Input:
{'match_all':{}}
Output:
{'"match_all"':{}}
Is there some regex that can do this?
I know I could iterate through the string and whenever I encounter a key replace each side of it with '“ followed by “'; however, I was wondering if any of you knew a more pythonic way of doing this.
why not try using this method: https://www.tutorialspoint.com/python/string_replace.htm and try to replace, ' for '" and the second ' for "'...
str = "this is string example....wow!!! this is really string"
print str.replace("is", "was")
print str.replace("is", "was", 3)
the output returns:
thwas was string example....wow!!! thwas was really string
thwas was string example....wow!!! thwas is really string
print str.replace("'", "'"")
print str.replace("'", ""'", 1)
use ' " as needed to avoid errors...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.