Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- In []: run txt2pdf.py Results/*.txt
- Out []: Writing 'ResultsA_2018_04_27_13_55.txt' with 80 characters per line and
- 60 lines per page...
- PDF document: 1 pages
- In [] : run txt2pdf.py Results/*.txt
- Out []: usage: txt2pdf.py [-h] [--font FONT] [--font-size FONT_SIZE]
- [--extra-vertical-space EXTRA_VERTICAL_SPACE]
- [--kerning KERNING] [--media MEDIA]
- [--minimum-page-length MINIMUM_PAGE_LENGTH] [--landscape]
- [--margin-left MARGIN_LEFT] [--margin-right MARGIN_RIGHT]
- [--margin-top MARGIN_TOP] [--margin-bottom MARGIN_BOTTOM]
- [--output OUTPUT] [--author AUTHOR] [--title TITLE]
- [--quiet] [--subject SUBJECT] [--keywords KEYWORDS]
- [--break-on-blanks] [--encoding ENCODING] [--page-numbers]
- [--line-numbers]
- filename
- txt2pdf.py: error: unrecognized arguments: ResultsA_2018_04_27_13_57.txt
- An exception has occurred, use %tb to see the full traceback.
- SystemExit: 2
- ./txt2pdf.py Results/first_file.txt
- ./txt2pdf.py Results/first_file.txt Results/second_file.txt
- import sh
- from glob import glob
- import os
- # commenting line by line
- def get_last_txt(path):
- return sorted( # sort
- glob(path + '/*.txt'), # all files in the folder
- key=lambda f: os.stat(f).st_mtime # by modified time
- )[-1] # return the last one
- sh.python('txt2pdf.py', get_last_txt("Results"))
Add Comment
Please, Sign In to add comment