我想提取一条新闻包含的数字,以及它周围的信息
到目前为止,我正在测试一个名为Bonobo的etl,用它打印我从新闻提要rss获得的信息。我的想法是使用这个etl提取数字和信息(我还不确定如何提取),但是如果你知道更好的方法,我洗耳恭听
[...]
for x in range(15):
title = NewsFeed.entries[x].title
desc = NewsFeed.entries[x].description
print(title)
print(desc)
print("\n")
def generate_data():
yield title
def uppercase(x: str):
return x.upper()
def output(x: str):
print(x)
graph = bonobo.Graph(
generate_data,
uppercase,
output,
)
if __name__ == '__main__':
bonobo.run(graph)
例如:
Giant birds, comparable in size to elephant birds and moa, have never been reported from Europe.[...] a giant bird with an estimated body mass of about 450 kg.
我希望输出结果如下:
|450|kg|body mass|giant bird|
因为下一步是将此信息上载到数据库表
目前没有回答
相关问题 更多 >
编程相关推荐