From b9a77fec24d314ca93e1f8a7eed17466f750cb4b Mon Sep 17 00:00:00 2001 From: Dom <97384583+tosemml@users.noreply.github.com> Date: Mon, 21 Aug 2023 23:20:43 -0700 Subject: [PATCH 1/2] use .join --- test_helper/test_sphinx_book/test_book_html.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test_helper/test_sphinx_book/test_book_html.py b/test_helper/test_sphinx_book/test_book_html.py index 995aa36d8..9dd902b1d 100644 --- a/test_helper/test_sphinx_book/test_book_html.py +++ b/test_helper/test_sphinx_book/test_book_html.py @@ -79,9 +79,7 @@ def get_html(self, html_file): Soup = bs4.BeautifulSoup(File, features="html.parser") title = Soup.title.text.split('—')[0] content = Soup.select('.body')[0] - conz = '' - for a in content: - conz += str(a) + '\n' + conz = '' + '\n'.join([str(a) for a in content]) return {'title': title, 'cnt': conz} From 21405dc13ccd560a196e8a62f8c67e5700526a3d Mon Sep 17 00:00:00 2001 From: Dom <97384583+tosemml@users.noreply.github.com> Date: Mon, 21 Aug 2023 23:23:11 -0700 Subject: [PATCH 2/2] use join --- torcms_taginfo/run_export_meta.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/torcms_taginfo/run_export_meta.py b/torcms_taginfo/run_export_meta.py index bf036263d..bae2d9b8d 100644 --- a/torcms_taginfo/run_export_meta.py +++ b/torcms_taginfo/run_export_meta.py @@ -40,8 +40,7 @@ def export_data(): for rec in recs: label = '' rec_label = MPost2Label.get_by_uid(rec.uid).objects() - for r_label in rec_label: - label += r_label.tag_name + ',' + label += ','.join([r_label.tag_name for r_label in rec_label]) infos = MPost.query_by_extinfo(key='cpbh', val=rec.extinfo['cpbh']) for info in infos: