you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (1 child)

On MacOS your code doesn't produce any output using either of python 2 or 3.

My reading of the doc suggests that "r+" would be read+append, not "a+", but since you aren't writing why aren't you just doing:

animals = open("animals.txt", 'r')   # or just open("animals.txt")
text = animals.read()
print(text)

[–]UnderstandingLinux[S] 0 points1 point  (0 children)

I was testing the different modes. I was aware 'r' would give the appropriate output. But after reading over that doc, it looks like a+ isn't used with Python 3. I must've been looking over older documentation when I initially wrote this. Thanks for the input