如果空格位于双引号之间,我想将空格替换为下划线。例子:
given = 'hello "welcome to" python "blog"'
expected = 'hello "welcome_to" python "blog"'
Run Code Online (Sandbox Code Playgroud)
我的实际字符串位于 SQL 代码中,我需要将其转换为使用下划线进行迁移。
given = 'hello "welcome to" python "blog"'
expected = 'hello "welcome_to" python "blog"'
Run Code Online (Sandbox Code Playgroud)
也一直在尝试谷歌,但还没有找到。
在Python中怎么做?