> For the complete documentation index, see [llms.txt](https://cai-sen-se.gitbook.io/leetcode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cai-sen-se.gitbook.io/leetcode/601-800/709.-zhuan-huan-cheng-xiao-xie-zi-mu.md).

# 709.转换成小写字母

[原题](https://leetcode-cn.com/problems/to-lower-case/)

大写A到Z的ascii码为65\~90，小写a到z为97到122，即小写字母的ascii等于大写+32

注意会有其他非字母的ascii字符，不发生转换

```python
class Solution:
    def toLowerCase(self, s: str) -> str:
        res = []
        for c in s:
            asc = ord(c)    #c的ascii码
            if asc >= 65 and asc <= 90:    #说明是大写字母
                lower = chr(asc + 32)   #转小写
                res.append(lower)
            else:
                res.append(c)
        return ''.join(res)
```
