将字符串中的大写字母转为小写
因为很简单,自己尽量想多种方法来尝试实现,本来想使用ASCII码实现(chr,ord)但是太麻烦了,想来想去有回归到下面两种:
class Solution:
def toLowerCase(self, str):
"""
:type str: str
:rtype: str
"""
# solution 1
# return str.lower()
# solution 2
temp=''
for char in str:
temp+=char.lower()
return temp