0
我试图从具有来自不同列表的#(哈希标签)的“句子”附加列表(空)。 目前我的代码给了我一个列表中涉及元素总数的新列表,而不是单个句子。用reg添加列表。表达式
的代码片段如下
import re
old_list = ["I love #stackoverflow because #people are very #helpful!","But I dont #love hastags",
"So #what can you do","Some simple senetnece","where there is no hastags","however #one can be good"]
new_list = [ ]
for tt in range(0,len(s)):
for ui in s:
if bool(re.search(r"#(\w+)",s[tt])) == True :
njio.append(s[tt])
给请让我知道如何追加仅单句。
@sberry ......如何关闭这个问题。 – LonelySoul 2013-02-22 19:39:22
只需点击左侧我答案旁边的复选标记。 – sberry 2013-02-24 02:17:07