-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[consider-using-with] Use the template allowing multiple files
- Loading branch information
1 parent
edaf96b
commit 7353853
Showing
3 changed files
with
1 addition
and
5 deletions.
There are no files selected for viewing
2 changes: 0 additions & 2 deletions
2
...ata/messages/c/consider-using-with/bad.py → ...ssages/c/consider-using-with/bad/close.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
file = open("apple.txt", "r", encoding="utf8") # [consider-using-with] | ||
contents = file.read() | ||
file.close() | ||
|
||
worst = open("banana.txt", "r", encoding="utf8").read() # [consider-using-with] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
contents = open("apple.txt", "r", encoding="utf8").read() # [consider-using-with] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,2 @@ | ||
with open("apple.txt", "r", encoding="utf8") as file: | ||
contents = file.read() | ||
|
||
with open("banana.txt", "r", encoding="utf8") as f: | ||
best = f.read() |