python 常用方法笔记

Type   方法名称 使用案例  备注信息
 
str.capitalize(self)
#首字母大写
In [1]: str="konglingchao"

In [2]: v=str.capitalize()
In [3]: print(v)
Konglingchao
 
    def capitalize(self): # real signature unknown; restored from __doc__
        """
        B.capitalize() -> copy of B

        Return a copy of B with only its first character capitalized (ASCII)
        and the rest lower-cased.
        """
        pass
 
str.casefold(self)
#可对未知字符进行相应的大小写转换
str.lower(self)
In [19]: str="KongLingChao"
In [20]: v=str.casefold()
In [21]: print(v)
konglingchao
In [22]: v=str.lower()
In [23]: print(v)
konglingchao
    def casefold(self): # real signature unknown; restored from __doc__
        """
        S.casefold() -> str

        Return a version of S suitable for caseless comparisons.
        """
        return ""
       
    def center(self, width, fillchar=None): # real signature unknown; restored from __doc__
        """
        S.center(width[, fillchar]) -> str

        Return S centered in a string of length width. Padding is
        done using the specified fill character (default is a space)
        """
        return ""
       
       
       
       
       
       
       
       
       
       
       

猜你喜欢

转载自www.cnblogs.com/konglingchao/p/9134163.html