# 写方法1 f = open('tmp.txt','w') f.write('hello world') f.close() # 写方法2 with open('tmp.txt','w') as f: f.write('hello \n word') # 读 with open('tmp.txt', 'r') as f: print(f.read()) # 逐行读 with open('tmp.txt','r') as f: for line in f.readlines(): print(l
Python 文本解析器 一.课程介绍 本课程讲解一个使用 Python 来解析纯文本生成一个 HTML 页面的小程序. 二.相关技术 Python:一种面向对象.解释型计算机程序设计语言,用它可以做 Web 开发.图形处理.文本处理和数学处理等等. HTML:超文本标记语言,主要用来实现网页. 三.项目截图 纯文本文件: Welcome to ShiYanLou ShiYanLou is the first experiment with IT as the core of online ed