Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
578 B
2
Indexable
Never
def chuyen_ngang_sang_doc(file_path, output_path):
    with open(file_path, 'r', encoding='utf-8') as file:
        file_content = file.readlines()

    with open(output_path, 'w', encoding='utf-8') as new_file:
        for text in file_content:
            text_convert = chuyen_dau_cau_thanh_chu(text)
            words = text_convert.split()
            for word in words:
                if " chấm " in word and '\n' in word:
                    new_file.write('chấm xuống dòng 1\n')
                else:
                    new_file.write(word + ' 0\n')