将文本排版转化为htmlä¸ç›¸åŒçš„排版。 为google blogæœåŠ¡
1 2 3 4 5 6 7 8 9 | #æ–‡æœ¬åŽŸæ ·åˆ°htmlä¸
#对æ¢è¡Œç¬¦çš„处ç†
#需求产生于:Google Blog
line_break="\n"
data=file("e://untitled.txt","r").read()
out=data.replace(line_break,"<br/>")
file("c://out.txt","w").write(out)
|
Tags: html
Well this is not very helpful, you need to do a lot more for a real HTML conversion. And why would you write out to .txt instead of .html? E.g. converting some Wiki-Markup to HTML converts Lists to <ul> elements and the like would be also necessary for a more interesting use case
Sure, you're winning a place inside the PyPy team with such awesome scripts... Waiting for html2txt version (a one liner maybe ?).
Please do not clutter up the recipe space with such trivialities, otherwise you might as well make "print 'hello world'" a recipe...