第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何將 python 輸出生成為 HTML

如何將 python 輸出生成為 HTML

天涯盡頭無女友 2023-10-24 15:25:08
import dominatefrom dominate.tags import *doc = dominate.document(title='Cell Value report')with doc:    with div():        attr(cls='body')        h2('Values Missing in the files.....')    with div(id='header').add(ol()):        for i in unique_file:            li(i.title())我嘗試了這個,以 HTML 形式生成 python 輸出。如果我在 中對路徑進行硬編碼,則 HTML 部分工作正常,os.listdir但如果我使用路徑作為輸入,則會顯示錯誤。search_path = input("Enter directory path to search: ")#directory pathfor fname in os.listdir(path=search_path):這是錯誤TypeError: listdir: path should be string, bytes, os.PathLike or None, not input_我什至嘗試了一個Python庫 yattag ,我必須循環(huán)并以HTML列表的形式打印它。我在yattag中嘗試過,但無法實現(xiàn),我不確定我做錯了什么。我應(yīng)該使用其他庫來實現(xiàn)我的輸出嗎?請給我一些建議。List[]
查看完整描述

1 回答

?
LEATH

TA貢獻1936條經(jīng)驗 獲得超7個贊

該錯誤是由于通配符導(dǎo)入造成的。from dominate.tags import *。dominate.tags定義一個input隱藏內(nèi)置input()函數(shù)的類。


這段代碼工作正常,沒有錯誤。


from dominate import tags

with doc:

    with tags.div():

        tags.attr(cls='body')

        tags.h2('Values Missing in the files.....')

    with tags.div(id='header').add(tags.ol()):

        for i in unique_file:

            tags.li(i.title())


查看完整回答
反對 回復(fù) 2023-10-24
  • 1 回答
  • 0 關(guān)注
  • 200 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號