![]() > f.readline() # Return an empty string after EOF > f.readlines() # Read all (next) lines into a list of strings ![]() > f.readline() # Read next line into a string > f.close() # Always close the file # Check the contents of the file created # Open the file created for reading and read line(s) using readline() and readlines() The '\n' will be translated to the platform-dependent newline ( '\r\n' for Windows or '\n' for Unixes/Mac OS).Įxamples # Open a file for writing and insert some records You need to explicitly terminate the str with a '\n', if needed. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |