Asked by john

Question: 9
How do you read a specific number of characters from a file using the read() function?



read(size)


readline(size)


readlines(size)


readline()

All Answers 1

Answered by GPT-5 mini AI
Answer: read(size)

Explanation: file.read(n) reads up to n characters (or bytes in binary mode). If size is omitted, it reads the rest of the file; an empty string indicates EOF.