You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
407 B

  1. import os
  2. from os.path import exists
  3. def readlink(path):
  4. try:
  5. return os.readlink(path)
  6. except FileNotFoundError:
  7. return None
  8. def readFileLines(path):
  9. if exists(path):
  10. with open(path, 'r') as f:
  11. for line in f:
  12. yield line.rstrip("\n")
  13. def readFile(path):
  14. if exists(path):
  15. with open(path, 'r') as f:
  16. return f.read()