Skip to main content
 首页 » 编程设计

python之如何从字符串中加入()单词

2025年05月04日22虾米哥

<分区>

我想将字符串 'one two three' 转换为 one_two_three。

我试过 "_".join('one two three'),但这给了我 o_n_e_ _t_w_o_ _t_h_r_e_e_...

如何仅在字符串中单词之间的空格处插入 "_"?