#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
file= open("cs.py","r",encoding = 'utf-8')
lines=file.readlines()
file.close()
strinfo = re.compile('^([\d\s])+')
file_data = ""
for line in lines:
if re.match("^([\d\s])+",line):
line=strinfo.sub("",line)
file_data +=line
with open("cs.py","w",encoding="utf-8") as f:
f.write(file_data)
转载于:https://www.cnblogs.com/hhjwqh/p/8439637.html