myfile.txt contains "to be or not to be that is the question"
I am trying to write my program to output x characters at a time on a newline such that an input of x=8 would be:
to be or
not to
be that
is the q
uestion
I am not sure how to get my code to continue to print the next 8 characters on a newline each time
def read_file():
x = int(input("How many letters do you want to read each time : ")) # number of characters to read on each newline
f = open('myfile.txt')
contents = f.read(x)
print(contents) # only prints first 8 characters
read_file()