如何使用 bs4/python 从维基百科站点获取 txt 文件中某个词的特殊搜索结果?

How can i get the special search results of a word in txt file from a Wikipedia site using bs4/python?

我在Wikipedia's特殊搜索模式页面搜索了一个词'Monocots'。特殊搜索 (special:WhatLinksHere) 结果显示 these words. 如何在 txt 文件中写入单词。 BeautifulSoup4/python? 有可能吗?

import bs4, requests

r = requests.get('https://ta.wikipedia.org/w/index.php?title=special:WhatLinksHere/Monocots&limit=500')
soup = bs4.BeautifulSoup(r.text, 'lxml')
for li in soup.find(id='mw-whatlinkshere-list').find_all('li'):
    print(li.a['title'])

输出:

கத்தூரி மஞ்சள்
கோரை
எருவை (புல்)
வார்ப்புரு:Taxonomy/Asparagus
வார்ப்புரு:Taxonomy/Asparagoideae
வார்ப்புரு:Taxonomy/Asparagaceae
வார்ப்புரு:Taxonomy/Asparagales
சாத்தாவாரி
மலையன்கிழங்கு
குழிவாழை
கருப்பன் புல்
காட்டுச்சேனை
துடைப்பப்புல்
கொண்டை ராகிசு
குறத்தி நிலப்பனை
செவ்வள்ளிக் கொடி
சாலமிசிரி

这是一个非常简单的任务,BS4 是正确的工具。