|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
Python基础教程中,第20章,有个模块simple_markup.py,内容如下:
import sys,re
from util import *
print'<html><head><title>...</title><body>'
title = True
for block in blocks(sys.stdin):
block = re.sub(r'\*(.+?)\*',r'<em>\1</em>',block)
if title:
print '<h1>'
print block
print '</h1>'
title = False
else:
print '<P>'
print block
print '</P>'
print '</body></html>'
这个模块必须在dos命令行下,使用python simple_markup.py <test_input.txt> test_output.html命令。
这种带有sys.stdin的模块能不能在Python 的IDLE中运行呢
|
|