mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Use with statement where it improves the documentation (closes #10461)
This commit is contained in:
parent
17b880a5d6
commit
a3dd56b6cf
5 changed files with 16 additions and 8 deletions
|
@ -750,8 +750,8 @@ It is also contained in the Python source distribution, as
|
|||
# we're passing these as arguments to the diff function
|
||||
fromdate = time.ctime(os.stat(fromfile).st_mtime)
|
||||
todate = time.ctime(os.stat(tofile).st_mtime)
|
||||
fromlines = open(fromfile, 'U').readlines()
|
||||
tolines = open(tofile, 'U').readlines()
|
||||
with open(fromlines) as fromf, open(tofile) as tof:
|
||||
fromlines, tolines = list(fromf), list(tof)
|
||||
|
||||
if options.u:
|
||||
diff = difflib.unified_diff(fromlines, tolines, fromfile, tofile,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue