Created
February 4, 2019 18:36
-
-
Save Robofied/1c912a8db263d0a9eb74b05ef086ae01 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Here opening the file with "with" keyword and it will automatically close the file after before coming out of the with. | |
with open('file1.txt','r') as f: | |
print(f.read()) | |
#[Output]: | |
1. "My name is XYZ". | |
2. "Currently I am persuing Bachelor's of Technology". | |
3. "I have done several projects on Software Development". | |
## Checking if file is closed. | |
print(f.closed) | |
#[Output]: | |
True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment