Write a python Program to get mode and encoding format of file with practical example.
The program will display name, mode and encoding format of given text file
- Open text file say book.txt in append mode and store it in file handler say “f”
- Use name attribute to display name of file
- Use mode attribute to display mode of file
- Use encoding attribute to display encoding formats of text file.
- Use closed attribute to check status of file.
- Print name,mode,encoding formats and status of file using print() function.
- Close text file say “book.txt” using close() function.
Below is implementation code/Source Code
Here is source code of the Python Program to get mode and encoding format of file. The program output is also shown below.