python练习册 每天一个小程序 第0011题

 1 # -*-coding:utf-8-*-
 2 
 3 
 4 def test(content):
 5     flag = 0
 6     with open('filtered_words.txt') as fp:
 7         for line in fp.readlines():
 8             if line.strip('\n') in content:
 9                 flag = 1
10             else:
11                 pass
12 
13     if flag == 1:
14         print "Freedom"
15     else :
16         print "Human rights"
17 
18 if __name__ == '__main__':
19     test()