OK, my coding is very rusty so I've been borrowing and adapting from tutorials.
I started playing around with BeautifulSoup opening a file with:
with open('event.html', encoding='utf8') as f:
soup = bs4.BeautifulSoup(f, "lxml")
Later, I need to find a string in the same file and BS seemed more complicated so I did:
lines = f.readlines()
And put it together with the previous instructions:
with open('event.html', encoding='utf8') as f:
soup = bs4.BeautifulSoup(f, "lxml")
lines = f.readlines()
Where I'm puzzled is that if I swap two lines and make that block like below:
with open('event.html', encoding='utf8') as f:
lines = f.readlines()
soup = bs4.BeautifulSoup(f, "lxml")
Then the rest of my code will break. Why is it?