# !/usr/bin/python27
# coding: utf8
'''
将文件中的每个字符后面加个空格
'''
with open('a.txt', 'r+') as filehandler:
with open('newtxt.txt','w') as filehandler2:
filehandler2.write(''.join([f+' ' for fh in filehandler for f in fh]))
import re
string = 'asdf32323313a1sd3213sad1f3d'
pattern = re.compile('.{1,1}')
print(' '.join(pattern.findall(string)))
0算数字么?
m = "00220202020202020222000200"
print ''.join(["%s " % i for i in m])
你用文件读写的形式,遍历每个字符,遍历的时候追加空格试试
str="002202020202022020220202"
newstr=" ".join([i for i in str])
print(newstr)