python转为html_Python 将文本转换成html的简单示例

本文介绍了如何使用Python将文本转换为HTML。示例中,一个名为`test_input.txt`的TXT文件被读取,然后通过`util.py`模块进行分块处理,再由`simple_markup.py`模块进行简单的标记转换,去除星号(*)包围的内容,并生成HTML文件`test_output.html`。转换后的HTML文件在浏览器中打开可查看效果。
摘要由CSDN通过智能技术生成

实例txt文件test_input.txt:

Welcome to World Wide Spam. Inc.

These are the corporate web pages of *World Wide Spam*,Inc.We hope

you find your stay enjoyable,and that you will sample many of our

products.

A short history if the company

World Wide Spam was started in the summer of 2000.The business

concept was to ride the dot-com wave ande to make money both through

bulk email and by selling canned meat online.

After receiving several complaints from customers who weren't

satisfied by their bulk email.World Wide Spam altered their profile,

and focused 100%on canned goods.Today,they rank as the world's

13,892nd online supplier of SPAM.

Destinations

From this page you may visit several of our intersting web pages:

-What is SPAM?(http://wwspam.fu/whatisspam)

-How do they make it?(http://wwspam.fu/howtomakeit)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值