字符串方法title()、istitle()
title()、istitle()
语义解释:
title() 方法返回"标题化"的字符串,就是说所有单词的首个字母转化为大写,其余字母均为小写。
istitle() 方法检测字符串中所有的单词拼写首字母是否为大写,且其他字母为小写。
实际运用:
1 a=b='hello world!' 2 print(a.title()) 3 print(a.title().istitle()) 4 print(b.istitle())
Hello World!
True
False
posted on 2018-08-16 11:29 DAY&DAY&UP 阅读(824) 评论(0) 收藏 举报
浙公网安备 33010602011771号