Feb-04-2021, 07:07 PM
You have my sincerest apologies if my question is terribly basic. I am very new to Python, but I have tried to exhaust all of my resources for the last couple of days before posting on this forum.
My goal is to create a looped function that scrolls the contents of a large .txt file vertically on a screen (with a time delay to make the text readable). My code so far is:
My goal is to create a looped function that scrolls the contents of a large .txt file vertically on a screen (with a time delay to make the text readable). My code so far is:
import time
f = open('Review.txt', 'r')
file_contents = f.read()
x = 0
while x <41000:
print (file_contents[x], end='')
x += 1
time.sleep(.01)
f.close()This is broadly functional, but there are two issues that I cannot find a solution to:- This method only prints full paragraphs at a time. I would prefer to print one character at a time.
- This method cuts words in half over multiple lines, puts commas alone at the beginning of lines, etc.
