Python 当前离线
少校
f = open('a.txt', 'r') all = f.readlines() f.close() for i in all: i = i[0] + i[1::].replace(' '+i[0],'') print i,复制代码
TOP
QIAOXINGXING 当前离线
六级士官
c = open('a.txt').readlines() for a in c: a = a[0] + a[1::].replace(' '+a[0],'') print a复制代码
CrLf 当前离线
论坛巡查
ts = open("d:\\a.txt") str = ts.read() import re reobj = re.compile(r"^(.)(.*)\1",re.M) print(reobj.sub(r"\1\2",str))复制代码