☞ We will perform the following operations on the file.
1. Writing 2. Reading
☞ To perform any kind of operations on the file, follow the steps :-
1. Open the file Syntax : <file_object> = open("<file_name>", "<mode>"); 2. Process the data 3. Close the file Syntax : <file_object>.close()
☞ Providing file_name
☞ This is the path of the current folder where the file name is specified by default.
☞Example :-
FileObject = open("inspirewebsoft.txt", "w")
☞ This is the path where the whole path is specified for creating and storing the file.
☞Example :-
FileObject = open("E:\\Desktop\\Documents\\inspirewebsoft.txt", "w") OR FileObject = open(r"E:\\Desktop\Documents\inspirewebsoft.txt", "w")