You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
475 B
Python

text = open('text.txt', 'r') # open the txt file
lines = text.readlines() # to divide the text into lines
lines_noempty = [ ]
x = 1
new_html = open('annotated-reader.html', 'a+')
for line in lines:
if line is not "\n": # if line is not empty,
outputfile = open('text_num.txt', 'a+')
outputfile.write('{0} {1} '.format(x, line))
new_html.write('<div id="{}"><linenumber>{}</linenumber><sentence>{}</sentence></div>'.format(x, x, line))
x = x + 1
new_html.close()