X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=set-title-list.py;h=d37398475ddae5de7d9b8006f4042ecfefe7c12d;hb=39125836fc96da8bd411da9b03bdc14b48eb4e9d;hp=065407ed1449c04adf35e6154f4620dacbcee09d;hpb=e2c7ec4349db18acd4c8d0902b0a5ab2cffd5be7;p=bookmarks_db.git diff --git a/set-title-list.py b/set-title-list.py index 065407e..d373984 100755 --- a/set-title-list.py +++ b/set-title-list.py @@ -42,7 +42,7 @@ def run(): URL = None title = None - title_list_file = open(args[0], 'r') + title_list_file = open(args[0], 'rt', encoding='utf-8') for line in title_list_file: line = line[:-1] # strip trailing newline if URL is None: @@ -58,7 +58,7 @@ def run(): ) else: # We've got 3 lines - add new entry to the mapping - if titles_dict.has_key(URL): + if URL in titles_dict: if title != titles_dict[URL]: raise ValueError( "titles are not identical for URL `%s': `%s' != `%s'" @@ -96,7 +96,7 @@ def run(): if object.isBookmark: URL = object.href - if titles_dict.has_key(URL): + if URL in titles_dict: name = titles_dict[URL] if object.name != name: object.name = name