python中title函数的作用

529次阅读
没有评论
python中title函数的作用

python中title函数的作用

1、title函数

python中字符串函数,返回’标题化‘的字符串,就是单词的开头为大写,其余为小写

2、语法

string.title()

3、使用实例

str=' tHe wOrLDwidE Web '

str.title()

str.title().strip()

输出

' The Worldwide Web '

'The Worldwide Web'

以上就是python中title函数的介绍,大家如果需要将字符串转换为标题格式,可以使用title函数哦~

神龙|纯净稳定代理IP免费测试>>>>>>>>天启|企业级代理IP免费测试>>>>>>>>IPIPGO|全球住宅代理IP免费测试

相关文章:

版权声明:wuyou2021-06-30发表,共计241字。
新手QQ群:570568346,欢迎进群讨论 Python51学习