Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233
  1. """ Takes an input citation file and formats it as a Refman (RIS) file.
  2. """
  3. __author__ = "Noëlle Anthony"
  4. __version__ = "0.1.0"
  5. import sys, os
  6. class Citation:
  7. def __init__(self, filename):
  8. chunks = filename.split(".")
  9. if len(chunks) == 1: # has no extension
  10. self.fn, self.ext = chunks[0], ""
  11. elif len(chunks) >= 3: # has multiple periods in filename, last one indicates extension
  12. self.fn, self.ext = ".".join(chunks[:-1]), chunks[-1]
  13. else: # has one period in filename
  14. self.fn, self.ext = chunks[0], chunks[1]
  15. def toString(self):
  16. return "Current file: {}.{}".format(self.fn, self.ext)
  17. def print(self):
  18. print("Current file: {}.{}").format(self.fn, self.ext)
  19. def main(filename):
  20. cite = Citation(filename)
  21. if __name__ == "__main__":
  22. args = sys.argv()
  23. if len(args) < 2:
  24. print("Input file required.")
  25. os.exit(0)
  26. main(args[1])