i3thuan5 / SuiSiann-KauTui

台灣媠聲標記網站
12 stars 3 forks source link

Beautifulsoup append 純文字 bug #311

Closed niauah closed 3 years ago

niauah commented 3 years ago
    for i, phiau_tag in enumerate(parser.p.contents):
        # 這个content是純文字
        if phiau_tag.name is None:
            sin_html.p.append(phiau_tag.string)
        else:
            # ...

輸入ê兩詞中央有空白ê時陣

<p><span class="lui-1">Hit</span> <span class="lui-2">lō</span></p>

append(phiau_tag.string) 會造成for loop減走一个,毋知影是siánn原因 改做append(str(phiau_tag)) 才會使

(兩个type無kâng,phiau_tag.stringNavigableStringhttps://www.crummy.com/software/BeautifulSoup/bs4/doc/index.html?highlight=new_tag#navigablestring

niauah commented 3 years ago

309

sih4sing5hong5 commented 3 years ago

看起來處理好勢--ah?