#初学python第一课-简单的文本过滤器#
2016-12-30 12:01
351 查看
第一个简单的python文本过滤器。
#敏感词过滤器 def text_creat(name,msg): desktop_path = 'C:/Users/lenovo/Desktop/'; full_path = desktop_path + name + '.txt'; file = open(full_path,'w'); file.write(msg); file.close(); print('Done'); def text_filter(word, censored_word='lame', changed_word='Awesome'): return word.replace(censored_word, changed_word); def wenben_filter(name,msg): clean_msg=text_filter(msg); text_creat(name,clean_msg); wenben_filter('hello','python is lame lame !!!');
相关文章推荐
- 【python初学】仿射加密的简单实现
- 初学python四:简单的输入输出
- Python初学-一个简单的小代码
- 初学python简单几点总结 一
- 初学python-练习_3使用python编写简单四则运算计算器
- 初学python:calendar和time模块的简单使用
- 初学Python推荐两款简单的编辑器。
- python初学 简单随机数方法及流程控制
- python socket 初学 串行双向聊天室的简单实现
- 初学Python写一个简单的登陆系统
- 简单的Python2.7编程初学经验总结
- 【python2.7初学日记】最初学习和编写的几个简单代码
- python基础学习第一课,如何两步简单安装python
- 一个简单的PYTHON代码
- Python与C++ 程序的简单实例对比
- Python 学习:今天写了一个简单的定时任务
- 利用 Python 做简单的代码生成
- IronPython for ASP.NET:使用IronPython创建一个简单的Web页面
- 初学JSP,写了一个简单页面访问计数器