I'm trying to make a script that reads a file, finds today's and yesterday's date and then prints all of the content between those two dates. However whenever I try to run this, I get expected a character buffer object on the last line.
import datetime
import re
today = datetime.date.today().day
yesterday = (today - 1)
file=open("test.txt","r")
s = file.read()
start = today
end = yesterday
print((s.split(start))[1].split(end)[0])
.split()expects a string, not an integer.(s.split(start))[1], and there's already a lot of parentheses, especially if you addstr, so they're worth removing. Just writes.split(start)[1].