filterLinkScript.py 326 B

1234567891011121314151617
  1. import sys
  2. import re
  3. filePath = sys.argv[1]
  4. text = None
  5. with open(filePath, "r") as f:
  6. text = f.readlines()
  7. if text:
  8. with open(filePath, "w") as f:
  9. for l in text:
  10. if not re.match(r'^#.*$',l) and not re.match(r'^[ ]+[0-9].*$',l):
  11. f.write(l)
  12. #print(l.rstrip())