Popular Python recipes tagged "batch"http://code.activestate.com/recipes/langs/python/tags/batch/2016-11-07T20:28:01-08:00ActiveState Code RecipesBatch conversion of text files to PDF with fileinput and xtopdf (Python) 2016-11-07T20:28:01-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580715-batch-conversion-of-text-files-to-pdf-with-fileinp/ <p style="color: grey"> Python recipe 580715 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/batch/">batch</a>, <a href="/recipes/tags/batchmode/">batchmode</a>, <a href="/recipes/tags/conversion/">conversion</a>, <a href="/recipes/tags/files/">files</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pdfwriter/">pdfwriter</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/text/">text</a>, <a href="/recipes/tags/text_processing/">text_processing</a>, <a href="/recipes/tags/utilities/">utilities</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>). </p> <p>This recipe shows how to do a batch conversion of the content of multiple text files into a single PDF file, with a) an automatic page break after the content of each text file (in the PDF output), b) page numbering, and c) a header and footer on each page.</p> <p>It uses the fileinput module (part of the Python standard library), and xtopdf, a Python library for conversion of other formats to PDF.</p> <p>xtopdf is available here: <a href="https://bitbucket.org/vasudevram/xtopdf" rel="nofollow">https://bitbucket.org/vasudevram/xtopdf</a></p> <p>and a guide to installing and using xtopdf is here:</p> <p><a href="http://jugad2.blogspot.in/2012/07/guide-to-installing-and-using-xtopdf.html" rel="nofollow">http://jugad2.blogspot.in/2012/07/guide-to-installing-and-using-xtopdf.html</a></p> <p>Here is a sample run of the program:</p> <p>python BTTP123.pdf text1.txt text2.txt text3.txt</p> <p>This will read the content from the three text files specified and write it into the PDF file specified, neatly formatted.</p> Batch download all the pinned pictures in your Pinterest board to a local folder (Python) 2016-02-18T17:26:50-08:00Alfred Wanghttp://code.activestate.com/recipes/users/4193275/http://code.activestate.com/recipes/580611-batch-download-all-the-pinned-pictures-in-your-pin/ <p style="color: grey"> Python recipe 580611 by <a href="/recipes/users/4193275/">Alfred Wang</a> (<a href="/recipes/tags/batch/">batch</a>, <a href="/recipes/tags/download/">download</a>, <a href="/recipes/tags/picture/">picture</a>, <a href="/recipes/tags/pinterest/">pinterest</a>). </p> <p>Batch download all the pinned pictures in your Pinterest board to a local folder. Be noted: you have to keep your internet browser signed in your Pinterest account first.</p> Zero (Batch) Programs (Python) 2012-07-10T12:37:37-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578205-zero-batch-programs/ <p style="color: grey"> Python recipe 578205 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/archive/">archive</a>, <a href="/recipes/tags/batch/">batch</a>, <a href="/recipes/tags/old/">old</a>, <a href="/recipes/tags/processing/">processing</a>, <a href="/recipes/tags/utility/">utility</a>). Revision 2. </p> <p>Having written many programs that work with groups of files, the zero programs were written based on a simple batch engine in the <code>zero</code> utility. All of the other programs import the first program to take advantage of its batch processor while supplementing there own functionality in place of zeroing out file data. This is committed for archival to be run under Python 2.5 or later versions.</p> Geocoding Lists via Google Maps (Python) 2012-05-11T05:06:27-07:00Mano Bastardohttp://code.activestate.com/recipes/users/4182040/http://code.activestate.com/recipes/578126-geocoding-lists-via-google-maps/ <p style="color: grey"> Python recipe 578126 by <a href="/recipes/users/4182040/">Mano Bastardo</a> (<a href="/recipes/tags/batch/">batch</a>, <a href="/recipes/tags/coordinates/">coordinates</a>, <a href="/recipes/tags/geocode/">geocode</a>, <a href="/recipes/tags/geocoding/">geocoding</a>, <a href="/recipes/tags/google/">google</a>, <a href="/recipes/tags/google_maps/">google_maps</a>, <a href="/recipes/tags/lat/">lat</a>, <a href="/recipes/tags/latitude/">latitude</a>, <a href="/recipes/tags/list/">list</a>, <a href="/recipes/tags/list_comprehension/">list_comprehension</a>, <a href="/recipes/tags/lng/">lng</a>, <a href="/recipes/tags/longitude/">longitude</a>, <a href="/recipes/tags/map/">map</a>, <a href="/recipes/tags/web/">web</a>). Revision 2. </p> <p>A simple script written as an experiment in geocoding addresses in a database. A list of addresses in the form of "100 Any Street, Anytown, CA, 10010" is passed to a Google Maps URL, and the latitude/longitude coordinates are extracted from the returned XML.</p> <p>XML methods are not used in this script, but simple string searches instead.</p> Putting watermark to images in batch (Python) 2009-06-20T18:05:08-07:00hasanatkazmihttp://code.activestate.com/recipes/users/4168973/http://code.activestate.com/recipes/576818-putting-watermark-to-images-in-batch/ <p style="color: grey"> Python recipe 576818 by <a href="/recipes/users/4168973/">hasanatkazmi</a> (<a href="/recipes/tags/batch/">batch</a>, <a href="/recipes/tags/image_processing/">image_processing</a>, <a href="/recipes/tags/pil/">pil</a>, <a href="/recipes/tags/watermark/">watermark</a>). </p> <p>Being a novice photographer, I usually have many pictures - sometimes in hundreds. While posting on Flickr or other online sources, it is very important to put watermark on all of them, like signature or email. This is a small self explanatory snippet which will place watermark image on right bottom corner. You just provide source folder and it will scan all photos in that folder (not sub folders) and will produce watermarked photos in the destination folder. It worked for me with jpg, it should work for all those formats which PIL can work with.</p>