I have a ".txt" file from which I was parsing and printing lines by two different ways, but instead of getting two outputs, I am only getting a single output of printed lines.
**pi_digits.txt contains**:--
3.141692653
897932384
264338327
Below is the code:
with open("pi_digits.txt") as file_object:
#contents = file_object.read()
#print(contents)
for line in file_object:
print(line.rstrip()) #deletes the whitespace of \n at the end of every string of file_object
lines = file_object.readlines()
for line in lines:
print(line.rstrip())`
output is only:
**
3.141692653
897932384
264338327
**
occurring 1 time but I think it should occur two times.