Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在构建一个文件托管应用程序。我想构建一个可以在静态文件中搜索的搜索表单(类似于 grep)。我已经通过 haystack 但它没有在静态文件中搜索。有没有相同的模块。
您可以只打开文件并逐字搜索内容。
for line in open("file"): if "search_string" in line: <do something>
如果速度至关重要(我想是这样),您可以事先准备好数据并使用您首选的搜索服务器坚持使用 haystack。