清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
#!/usr/bin/python import sys input = sys.argv[1] fp = open(input,"r") flag = 0 quote = 0 for line in fp: myline = "" length = len(line) for index in range(length): if flag == 0 and quote == 0 and line[index] == "\"": quote = 1 myline += line[index] continue if flag == 0 and quote == 1 and line[index] == "\"": quote = 0 myline += line[index] continue if quote != 1 and flag == 2 and line[index] == "\n": flag = 0 if quote != 1 and flag == 0 and line[index] == "/" and line[index+1] == "*": flag = 1 if quote != 1 and index > 0 and flag == 1 and line[index-1] == "/" and line[index-2] == "*": flag = 0 if quote != 1 and flag == 0 and line[index] == "/" and line[index+1] == "/": flag = 2 if flag == 1 or flag == 2: continue myline += line[index] print myline, fp.close()