Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
docs for text2pdf
#5
(Dec-16-2018, 11:57 AM)Pedroski55 Wrote: I have 300+ files to convert, so a script is very useful.
If i try to doing it with code used over.
So it's command line based,to not rewrite can use subprocess in a loop.
import glob
import subprocess

for start,file in  enumerate(glob.glob("*.txt"), 1):
    subprocess.run(['python', 'txt2pdf.py', '--output', f'txt{start}.pdf', file])
So glob find all .txt in folder,then use output argument to make new file name each time.
So output will be.
Output:
txt1.pdf txt2.pdf txt3.pdf txt4.pdf ...ect
Reply


Messages In This Thread
docs for text2pdf - by Pedroski55 - Dec-16-2018, 07:57 AM
RE: docs for text2pdf - by Gribouillis - Dec-16-2018, 11:54 AM
RE: docs for text2pdf - by Pedroski55 - Dec-16-2018, 11:57 AM
RE: docs for text2pdf - by snippsat - Dec-16-2018, 12:24 PM
RE: docs for text2pdf - by snippsat - Dec-16-2018, 03:20 PM
RE: docs for text2pdf - by Larz60+ - Dec-16-2018, 06:43 PM
RE: docs for text2pdf - by Pedroski55 - Dec-21-2018, 01:38 AM
RE: docs for text2pdf - by snippsat - Dec-21-2018, 06:19 PM
RE: docs for text2pdf - by Pedroski55 - Dec-22-2018, 10:53 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Is 2 a prime number? for loop & range fuction in python docs says yes, mine says no. allusernametaken 4 3,017 Nov-17-2019, 02:56 AM
Last Post: allusernametaken
  pickle docs say bytes in one place, strings in another Skaperen 2 2,221 Jul-29-2019, 05:13 PM
Last Post: Skaperen
  [split] Using this Python version of text2pdf jonsnow1221 1 2,177 May-07-2019, 07:48 PM
Last Post: micseydel
  Using this Python version of text2pdf Pedroski55 1 2,404 Apr-15-2019, 08:12 AM
Last Post: Pedroski55

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020