python 列表字符串 转小写
时间: 2023-09-22 09:06:04 浏览: 55
可以使用列表推导式和字符串的 `lower()` 方法来实现将列表中的字符串转为小写,示例代码如下:
```python
my_list = ['Hello', 'WORLD', 'Python']
lower_list = [word.lower() for word in my_list]
print(lower_list)
```
输出结果为:
```
['hello', 'world', 'python']
```
相关问题
python 字符串转小写
请使用字符串的 `lower()` 方法将字符串转换为小写。以下是一个示例:
```python
string = "Hello World"
lowercased_string = string.lower()
print(lowercased_string)
```
输出结果为:
```
hello world
```
python字符串转小写
可以使用字符串的 `lower()` 方法来将字符串转换为小写,例如:
```python
string = "Hello, World!"
lowercase_string = string.lower()
print(lowercase_string)
```
输出结果为:
```
hello, world!
```
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)