[Solved] Questions about readlines():
A) Given 1) file.readlines() and file.readlines(0) return all the lines and 2) file.readlines(x), x: x != 0 return the first line of file = open('notes.txt', 'r'), Is it the case that what amounts to "0" and "anything but zero" respectively in the readlines argument are in fact the logic cases True and False, and True in this case is default "all the list items" and false by default is not "not all the list items" but "the first list item"? I kept trying stuff on my app and I can't make any other sense of this. Can you confirm or deny and explain? B) If you have 2 lines in notes.txt, print(file.readlines(500)) print(file.readlines()[1]) file.close() are run at once, it throws an "index is out of range" exception for the 2nd one. When you run each separately by hashing out the other, you get ["Line 1\n"] and ['Line 2\n'] respectively. So why the error when they are run together? Does that mean the first one does not just pick the 1st line but also truncates the list of lines to itself? Mutability?