可以使用Python代码来实现此操作:
string = "This is a string with spaces"
new_string = string.replace(" ", "_")
print(new_string)
This_is_a_string_with_spaces
这个代码将创建一个字符串并在其中搜索所有空格,然后使用str.replace()方法将其替换为下划线。
|
|
没读研的匕首 · 中国驰捷汽车完成与SPAC合并,今晚正式挂牌 ...· 2 年前 · |
|
|
奋斗的小马驹 · VBA二维数组自定义排序 - 知乎· 3 年前 · |
|
|
聪明伶俐的鞭炮 · android - Unable to ...· 3 年前 · |
|
|
刚毅的鼠标 · Glide-图片的压缩_glide压缩图片_ ...· 3 年前 · |
| 字符串函数 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 |
|
|
悲伤的野马
3 年前 |
|
|
奋斗的小马驹 · VBA二维数组自定义排序 - 知乎 3 年前 |