可以使用Python代码来实现此操作:
string = "This is a string with spaces"
new_string = string.replace(" ", "_")
print(new_string)
This_is_a_string_with_spaces
这个代码将创建一个字符串并在其中搜索所有空格,然后使用str.replace()方法将其替换为下划线。
|
|
销魂的烈马 · Traceback (most ...· 1 年前 · |
|
|
彷徨的香菇 · Python小工具-复制嵌套目录下的多个wo ...· 1 年前 · |
|
|
打篮球的卤蛋 · 一天完成react面试准备-腾讯云开发者社区 ...· 2 年前 · |
|
|
暗恋学妹的吐司 · ICML2021会议论文列表(可下载)_AM ...· 2 年前 · |
|
|
酷酷的牛腩 · 自定义窗口布局和个性化文档选项卡 - ...· 2 年前 · |
| 字符串函数 python字符串连接 python字符串操作 下划线 |
| https://juejin.cn/s/%E6%80%8E%E4%B9%88%E5%B0%86%E7%A9%BA%E6%A0%BC%E6%9B%BF%E6%8D%A2%E4%B8%BA%E4%B8%8B%E5%88%92%E7%BA%BF |
|
|
悲伤的野马
2 年前 |
|
|
销魂的烈马 · Traceback (most recent call last): File "/Users/jason/Downloads/yolov5-5.0/detect.py", line 183, i 1 年前 |
|
|
打篮球的卤蛋 · 一天完成react面试准备-腾讯云开发者社区-腾讯云 2 年前 |