Home Forums Job & Work Life Python으로 파일 내용 변환하기 Python으로 파일 내용 변환하기 Name * Password * Email 간단하게 bracket을 비교하면 안될까요? for line in infile: commented = False if line == IFLINE: numbracket = [0,0] commented = True: outfile.write("//"+line) if commented: numbracket[0] += line.count("{") numbracket[1] += line.count("}") if numbracket[0] == numbracket[1]: outfile.write("//}\n") commented = False else: outfline.write(line) else: outfile.write(line) I agree to the terms of service Comment