python字符串islower()方法

时间:2018-06-06 04:28:07

标签: python

input :ash.capitalize()
output:'Abv dfgrjjdhjheyooadfhshfheyoohey2255'
input:ash.islower()
output:True

为什么islower()方法的输出为true,即使“ash”字符串的第一个字符是大写字母。

1 个答案:

答案 0 :(得分:0)

ash.capitalize()不会将 ash 的值更改为 Abv dfgrjjdhjheyooadfhshfheyoohey2255 。相反,它返回一个需要存储在另一个变量中的字符串。 因此,如果我们在islower()上调用ash,它仍然是小写的。 如何做的一个例子: -

   x = "abv dfgrjjdhjheyooadfhshfheyoohey2255";
   y = x.capitalize();
   print y.islower();

相同的文件: -

capitalize function