mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-06-17 19:21:28 +00:00
Use a context manager for opening files
This commit is contained in:
parent
7a6b779e77
commit
317b68bc08
@ -109,7 +109,8 @@ def readlist(filename, uniq=True):
|
||||
print('File "%s" does not exist.' % filename)
|
||||
return False
|
||||
|
||||
content = open(filename).read().replace('\n', ' ').replace(',', ' ')
|
||||
with open(filename) as f:
|
||||
content = f.read().replace('\n', ' ').replace(',', ' ')
|
||||
|
||||
if not content.strip():
|
||||
print('File "%s" is empty.' % filename)
|
||||
|
Loading…
x
Reference in New Issue
Block a user