Python Splitting数组字符串

我有一个 Python列表,如下所示:

["Hello,My Name is John","Good Afternoon,my name is David","I am three years old"]

我想将每个字符串拆分为逗号分隔列表并存储结果,并将每个单词转换为小写:

[['hello','my','name','is','john'],['good','afternoon','david'],['i','am','three','years','old']]

有任何建议如何做到这一点?
谢谢.

解决方法

试试以下代码

x = ["Hello,"I am three years old"]

z = []

for i in x:
    # Replacing ",",converting to lower and then splitting
    z.append(i.replace("," ").lower().split())

print z

输出

[['hello','old']]

相关文章

功能概要:(目前已实现功能)公共展示部分:1.网站首页展示...
大体上把Python中的数据类型分为如下几类: Number(数字) ...
开发之前第一步,就是构造整个的项目结构。这就好比作一幅画...
源码编译方式安装Apache首先下载Apache源码压缩包,地址为ht...
前面说完了此项目的创建及数据模型设计的过程。如果未看过,...
python中常用的写爬虫的库有urllib2、requests,对于大多数比...