I am trying to parse out the contents of two different tags in a txt file and I am getting all the instances of the first tag "p" but not the second "l". Is the problem with the "or"?
Thanks for the help. Here is the code I am using
with open('standardA00456.txt','w') as output_file:
with open('standardA00456.txt','r') as open_file:
the_whole_file = open_file.read()
start_position = 0
while True:
start_position = the_whole_file.find('<p>' or '<l>', start_position)
end_position = the_whole_file.find('</p>' or '</l>', start_position)
data = the_whole_file[start_position:end_position+5]
output_file.write(data + "\n")
start_position = end_position
' or ''` will always equal `'
– dwitvliet Aug 10 '14 at 15:27'`.