python 一些常用函数
2022/4/15 22:12:45
本文主要是介绍python 一些常用函数,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
str
# C标准中空白字符有:空格(' ')、换页('\f')、换行('\n')、回车('\r')、水平制表符('\t')、垂直制表符('\v') str.strip() # 去除两边空白符(whitespaces); str.lstrip()去除左空白; str.rstrip()去除右空白 str.replace(' ', '') # 去除全部空格 ''.join(str.split()) #去除全部空白符 str.split(str='', num=string.count(str)) #分割字符串,返回list #分隔符str默认为所有的空字符,包括空格、换行(\n)、制表符(\t)等。
用到再记
这篇关于python 一些常用函数的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-03-30开始python成长之路
- 2024-03-29python optparse
- 2024-03-29python map 函数
- 2024-03-20invalid format specifier python
- 2024-03-18pool.map python
- 2024-03-18threads in python
- 2024-03-14python Ai 应用开发基础训练,字符串,字典,文件
- 2024-03-13id3 algorithm python
- 2024-03-13sum array elements python
- 2024-03-12python colon equals