gpt4 book ai didi

python - 如何将列表列表中的元素转换为小写?

转载 作者:太空宇宙 更新时间:2023-11-04 06:50:04 24 4
gpt4 key购买 nike

我正在尝试将列表中的元素转换为小写。这就是它的样子。

print(dataset)
[['It', 'went', 'Through', 'my', 'shirt', 'And', 'came', 'out', 'The', 'back', 'and', 'hit', 'the', 'kid', 'behind', 'me', 'in', 'the', 'toe']]

我试过这样做:

for line in dataset:
rt=[w.lower() for w in line]

然而,这给了我一个错误,说列表对象没有属性 lower()。

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com