python中strip()函数
时间: 2023-11-02 19:24:11 浏览: 91
在Python中,strip()函数是用于移除字符串头尾指定的字符。它的语法是str.strip([chars]),其中chars是可选参数,用于指定需要移除的字符。该函数返回一个新的字符串,不包含被移除的字符。需要注意的是,该方法只能删除开头或是结尾的字符,不能删除中间部分的字符。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [python中的strip()函数](https://blog.csdn.net/aoheng0603/article/details/101277980)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [Python:strip() 函数](https://blog.csdn.net/weixin_40522801/article/details/106473814)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文