zoukankan      html  css  js  c++  java
  • 709. 转换成小写字母

     1 class Solution(object):
     2     def toLowerCase(self, str):
     3         """
     4         :type str: str
     5         :rtype: str
     6         """
     7         res = ""
     8         for i, ch in enumerate(str):
     9             if ord(ch) <= 90 and ord(ch) >= 65:
    10                 res += chr(ord(ch) + 32)
    11             else:
    12                 res += ch
    13         return res
    14 
    15     def toLowerCase2(self, str):
    16         """
    17         :type str: str
    18         :rtype: str
    19         """
    20         return str.lower()
    21 
    22 
    23 if __name__ == '__main__':
    24     solution = Solution()
    25     print(solution.toLowerCase("HellO"))
  • 相关阅读:
    多行文字垂直居中效果(利用flex)
    Switch
    Scanner
    Method
    Recursion递归
    for
    if
    dowhile
    while
    DataType 数据类型
  • 原文地址:https://www.cnblogs.com/panweiwei/p/12697773.html
Copyright © 2011-2022 走看看