# -*- coding: utf-8 -*-
import re
def clearBlankLine(infile,outfile):
    file1 = open(infile, 'r') # 要去掉空行的文件
    file2 = open(outfile, 'w') # 生成没有空行的文件
    try:
        line = file1.readlines()
        for i in range(0, len(line)):
            result1 = re.search('\d:\d', line[i])
            if result1 != None:
                line[i] = '\n'
            # result2 = re.search('\d-\d', line[i])
            # if result2 != None:
            #     line[i] = line[i].split()

        for i in range(0,len(line)):
            if line.count('\n')>0:
                line.remove("\n")
            elif line.count('字幕\n') > 0:
                line.remove('字幕\n')

        file2.writelines(line)
    finally:
        file1.close()
        file2.close()


if __name__ == "__main__":
    clearBlankLine("Result_Bilibili.txt","Result_Bilibili_Reformatted.txt")
c2fb1bc615e90c5a826e176474c3a105f7245ae4
<mask token>

<mask token>


def clearBlankLine(infile, outfile):
    file1 = open(infile, 'r')
    file2 = open(outfile, 'w')
    try:
        line = file1.readlines()
        for i in range(0, len(line)):
            result1 = re.search('\\d:\\d', line[i])
            if result1 != None:
                line[i] = '\n'
        for i in range(0, len(line)):
            if line.count('\n') > 0:
                line.remove('\n')
            elif line.count('字幕\n') > 0:
                line.remove('字幕\n')
        file2.writelines(line)
    finally:
        file1.close()
        file2.close()


<mask token>

<mask token>


def clearBlankLine(infile, outfile):
    file1 = open(infile, 'r')
    file2 = open(outfile, 'w')
    try:
        line = file1.readlines()
        for i in range(0, len(line)):
            result1 = re.search('\\d:\\d', line[i])
            if result1 != None:
                line[i] = '\n'
        for i in range(0, len(line)):
            if line.count('\n') > 0:
                line.remove('\n')
            elif line.count('字幕\n') > 0:
                line.remove('字幕\n')
        file2.writelines(line)
    finally:
        file1.close()
        file2.close()


if __name__ == '__main__':
    clearBlankLine('Result_Bilibili.txt', 'Result_Bilibili_Reformatted.txt')

import re


def clearBlankLine(infile, outfile):
    file1 = open(infile, 'r')
    file2 = open(outfile, 'w')
    try:
        line = file1.readlines()
        for i in range(0, len(line)):
            result1 = re.search('\\d:\\d', line[i])
            if result1 != None:
                line[i] = '\n'
        for i in range(0, len(line)):
            if line.count('\n') > 0:
                line.remove('\n')
            elif line.count('字幕\n') > 0:
                line.remove('字幕\n')
        file2.writelines(line)
    finally:
        file1.close()
        file2.close()


if __name__ == '__main__':
    clearBlankLine('Result_Bilibili.txt', 'Result_Bilibili_Reformatted.txt')

# -*- coding: utf-8 -*-
import re
def clearBlankLine(infile,outfile):
    file1 = open(infile, 'r') # 要去掉空行的文件
    file2 = open(outfile, 'w') # 生成没有空行的文件
    try:
        line = file1.readlines()
        for i in range(0, len(line)):
            result1 = re.search('\d:\d', line[i])
            if result1 != None:
                line[i] = '\n'
            # result2 = re.search('\d-\d', line[i])
            # if result2 != None:
            #     line[i] = line[i].split()

        for i in range(0,len(line)):
            if line.count('\n')>0:
                line.remove("\n")
            elif line.count('字幕\n') > 0:
                line.remove('字幕\n')

        file2.writelines(line)
    finally:
        file1.close()
        file2.close()


if __name__ == "__main__":
    clearBlankLine("Result_Bilibili.txt","Result_Bilibili_Reformatted.txt")