Here is Python script that needs the .dat file verses found on the next page ...
Code Select
# verseForToday.py
# this version: 20240222
from sys import exit
from datetime import datetime
# get the 1st 10 chars after datetime object converted to type str
todayStr = str( datetime.now() )[:10]
monthStr = todayStr[5:7] # get new substr taking chars from index 5 to 6 inclusive
dayStr = todayStr[8:] # get new substr taking chars from index 8 to end
dayNumStr = monthStr + dayStr
print(f"Today is: {dayNumStr} or {todayStr}")
print()
verses = [] # construct an empty Python list container to hold lines of text
try:
with open("verses.dat") as f:
line = f.readline()
while line:
if line[:4] == dayNumStr:
print( line.rstrip() )
line = line[4:]
verses.append( line.strip() )
line = f.readline()
except:
print("There was some problem getting verses from file: verses.dat ...")
input("Press Enter key to exit ... ")
exit()
print()
for line in verses:
print(' '*9 + line)
input("\nPress ENTER key to exit ... ")