I’ve read the documentation, but what does readlines(n) do? By readlines(n), I mean readlines(3) or any other number.
When I run readlines(3), it returns same thing as readlines().
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The optional argument should mean how many (approximately) bytes are read from the file. The file will be read further, until the current line ends:
Another quote:
You’re right that it doesn’t seem to do much for small files, which is interesting:
One might think it’s explained by the following phrase in the documentation:
However, even when I try to read the file without buffering, it doesn’t seem to change anything, which means some other kind of internal buffer is meant:
On my system, this internal buffer size seems to be around 5k bytes / 1.7k lines: