[Solved] Add HTML tags to text using Python
[ad_1] The code below did what I needed. with open(“finalfile.txt”, ‘w’, encoding=’utf-8′) as File2, open(“test.txt”, “r”, encoding=’utf-8′) as File1: previous_line = “” new_line = “” double_dash_prev_line = False single_dash_prev_line = False for line in File1: current_line = line if line[0] == “-“: if line[1] != “-“: if single_dash_prev_line == False and double_dash_prev_line == False: new_line … Read more