# -*-coding:utf-8-*- def test(content): text = content flag = 0 with open('filtered_words.txt') as fp: for line in fp.readlines(): text = text.replace(line.strip('\n'),'**') # print text #print text fp.close() print text if __name__ == '__main__': te…
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 p…
写一个小程序,用来计算它包含的代码所需的耗时.虽然简单,测试代码是否耗时还是有点用的,不用重新写嘛~ import java.util.Date; import java.util.concurrent.TimeUnit; public class TimeLag { private Date start; private Date end; public TimeLag() { start = new Date(); } public String cost() { end = new Dat…