本帖最后由 pcl_test 于 2015-8-22 09:21 编辑
- #!/usr/bin/env python
- # encoding: utf-8
- import re
- file1 = open('1.txt', 'r')
- txt = file1.read()
- reg = re.compile(r'[\da-z特殊字符]', re.I)
- txt = reg.sub('', txt)
- file2 = open('2.txt','w')
- file2.write(txt)
- file1.close()
- file2.close()
- print "完成"
复制代码
|