Here is the Python script that extracts daily 5 Psalms ... Psalm 1 to 5 for day 1 of each month, 6 to 10 for day 2 of the month, 11 to 15 for day 3 ... etc...
Save this as a text file as: DailyPsalms.py file in a folder ...
and also save the text file it needs ... see it on the next page ... save that text in the same folder as: 1To150PsalmsFixed.txt
#DailyPsalms.py
#2024-02-15
from datetime import date
from sys import exit
fNameFixed = "1To150PsalmsFixed.txt"
try:
with open(fNameFixed) as f:
lines = f.readlines() # get lines into Python list called lines
except:
print("Can't find file", fNameFixed, "... ")
input("PRESS Enter key to exit ... ")
exit()
#get current date
now = date.today()
day = now.day
print("Today is: {:4d}-{:02d}-{:02d}".format(now.year, now.month, day))
if day == 31: # there are only 150 Psalms
day = 30
end = day*5
beg = end-4
these = [] # get a Python list of these ...
for x in range(beg, end+1):
these.append( '(Ps ' + str(x) + ':' )
verses = [] # get todays 5 verses into Python list of verses
for line in lines:
for text in these:
if text in line:
verses.append(line)
for line in verses:
print()
count = 0
for ch in line:
count += 1
if count <= 40:
if count == 1 and ch == ' ':
count = 0
else:
print( ch, end = '' )
else: #count here is > 40
print(ch, end = '')
if ch in " .,?!":
print()
count = 0
if ch == '\n':
count = 0
input("\nPress 'Enter' to quit ... " )