I want to print the characters in a line one at a time. What this code ends up doing is reading the entire line one character at a time (with a pause between each character, so I know it is iterating through the characters correctly) then when it finishes that line, it will print all of the characters at once.
for line in lines:
for ch in line:
print(ch, end = ' ')
os.system("pause")
However, if I do:
for line in lines:
for ch in line:
print(ch, end = '\n') #same effect as print(ch)
os.system("pause")
it will print one character with a newline, then a system pause.
Why will it not print correctly in the first scenario but work in the second?
Also, I just ran a random test:
print ("is", end=' ')
os.system("pause")
print("newline?")
It did not print my message until after the system pause. Why did it not print "is" before the pause? It seems like there is some hidden workings of the print() function than I am not understanding. Anyone have some explanations?