importer: Use with-block to open file.
This commit is contained in:
parent
17816bdab2
commit
0a7ff8db09
@ -50,8 +50,8 @@ def get_args():
|
||||
def import_chromium(bookmarks_file):
|
||||
"""Import bookmarks from a HTML file generated by Chromium."""
|
||||
import bs4
|
||||
|
||||
soup = bs4.BeautifulSoup(open(bookmarks_file, encoding='utf-8'))
|
||||
with open(bookmarks_file, encoding='utf-8') as f:
|
||||
soup = bs4.BeautifulSoup(f)
|
||||
|
||||
html_tags = soup.findAll('a')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user