在文件中:
Hello........girlllllllllll
W.o.W
我试过:
for line in file.split('\n'):
line = re.sub('[.]+', ' ', line)
line = re.sub('[.]', '', line)
print line
结果表明:
Hello girlllllllllll
W o W
是否有可能得到如下结果?
Hello girlllllllllll
WoW
有什么建议吗?