from bs4 import BeautifulSoup # 原始 HTML 程式碼 html_doc = """ Hello World

Test Header

This is a test.

Link 1 Link 2

Hello, Bold Text

""" # 以 Beautiful Soup 解析 HTML 程式碼 #url = 'https://dct.ntcu.edu.tw/news.php' soup = BeautifulSoup(html_doc, 'html.parser') print(soup.prettify())