isolde

navigating text file searches in python

匿名 (未验证) 提交于 2019-12-03 09:10:12
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: here is sample of the text file I am working with: <Opera> Tristan/NNP and/CC Isolde/NNP and/CC the/DT fatalistic/NN horns/VBZ The/DT passionate/JJ violins/NN And/CC ominous/JJ clarinet/NN ;/: The capital letters after the forward slashes are weird tags. I want to be able to search the file for something like "NNP,CC,NNP" and have the program return for this segment "Tristan and Isolde" , the three words in a row that match those three tags in a row. The problem I am having is I want the search string to be user inputed so it will