Python3 File Close
# Python3.x Python3 File close() Method
[ Python3 File Methods](#)
* * *
### Overview
The **close()** method is used to close an already opened file. A closed file cannot be read or written to, otherwise it will trigger a _ValueError_. The close() method can be called multiple times.
When a file object is reassigned to another file, Python automatically closes the previous file object. Using the close() method to close a file is a good practice.
### Syntax
The syntax for the close() method is as follows:
fileObject.close();
### Parameters
* **None**
### Return Value
This method does not return a value.
### Example
The following example demonstrates the use of the close() method:
#!/usr/bin/python3# Open file fo = open("tutorial.txt", "wb")print("File name: ", fo.name)# Close file fo.close()
The output of the above example is:
File name: tutorial.txt
* * Python3 File Methods](#)
YouTip