```python
# -*- coding: utf-8 -*-
'''
遇到文中的空格就換行
'''
def delblankline(infile, outfile):
infopen = open(infile, 'r',encoding="utf-8")
outfopen = open(outfile, 'w',encoding="utf-8")
db = infopen.read()
outfopen.write(db.replace(' ','\n'))
infopen.close()
outfopen.close()
delblankline("jb51.txt", "o3.txt")
```
Python3 replace()方法
描述
replace() 方法把字符串中的 old(舊字符串) 替換成 new(新字符串),如果指定第三個參數max,則替換不超過 max 次。
