输入 :
126211 consecutive prog runs error logged debug core
126262 manual change memory view propagated views like variable view expression view
输出
126211 : consecutive prog runs error logged debug core
126262 : manual change memory view propagated views like variable view expression view
代码
def function_1():
filename = open('input.txt', 'r')
for line in filename:
#print line
line = line.rstrip('')
#line1= re.sub('[^\w ]','',line)[8:]
#print line1
问题是我需要读取每行的第一个数字并在两边添加一个带有空格的冒号 (:)。任何建议将不胜感激。谢谢。