I have a question about line 5 in the 4th lesson of the Introduction to NumPy section (under the Pandas and NumPy Fundamentals course). I understand the code except for what the “r” is in reference to– could someone clarify this? Thank you in advance!
open() function has two parameters and has its general syntax as
open(file, mode) .
file parameter accepts the path and name of the file
mode parameter defines which mode you want to open the file in and it accepts string values such as :
"r" - Read mode, which opens the file for reading
"a" - Append mode, Opens the file for appending.
"w" - Write mode, Opens the file for writing.
"x" - Create mode, Creates the specified file.
I hope this answers your question.
Thank you so much! My confusion was with not realizing mode had a default/was optional. (I ended up finding the documentation, which probably should have been my first step. )