有没有办法在python中搜索特定的单词,比如'或'.我这样做了:
word = raw_input("what do you want to search? ") for filee in open('text.txt'): if word in filee: print "found"
但它会查找字符串'或'.例如; 如果text.txt中包含'world'一词或包含'or'字符串的其他单词,则打印出"found"
有没有办法只搜索特定的单词'或'?