可以使用Python代码来实现此操作:
string = "This is a string with spaces"
new_string = string.replace(" ", "_")
print(new_string)
This_is_a_string_with_spaces
这个代码将创建一个字符串并在其中搜索所有空格,然后使用str.replace()方法将其替换为下划线。
|
|
淡定的登山鞋 · 2019级海洋科学研究生培养方案-上海交通大 ...· 1 年前 · |
|
|
另类的电脑桌 · 频道头条--文史--中国作家网· 2 年前 · |
|
|
调皮的小笼包 · 中美合拍片《功夫熊貓3》:與中國文化"無縫對 ...· 2 年前 · |
|
|
活泼的铁链 · 大学女教授韩国漫� - 搜狗图片搜索· 2 年前 · |