Popular recipes tagged "converter" but not "pdf"http://code.activestate.com/recipes/tags/converter-pdf/2015-01-18T19:14:38-08:00ActiveState Code RecipesBytes-to-human / human-to-bytes converter (Python) 2012-02-02T16:09:52-08:00Giampaolo RodolĂ http://code.activestate.com/recipes/users/4178764/http://code.activestate.com/recipes/578019-bytes-to-human-human-to-bytes-converter/ <p style="color: grey"> Python recipe 578019 by <a href="/recipes/users/4178764/">Giampaolo RodolĂ </a> (<a href="/recipes/tags/bytes/">bytes</a>, <a href="/recipes/tags/conversion/">conversion</a>, <a href="/recipes/tags/converter/">converter</a>, <a href="/recipes/tags/human/">human</a>, <a href="/recipes/tags/humanize/">humanize</a>, <a href="/recipes/tags/string/">string</a>). Revision 15. </p> <p>Here goes.</p> Image Converter (Python) 2015-01-18T19:14:38-08:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/579007-image-converter/ <p style="color: grey"> Python recipe 579007 by <a href="/recipes/users/4172570/">FB36</a> (<a href="/recipes/tags/conversion/">conversion</a>, <a href="/recipes/tags/conversions/">conversions</a>, <a href="/recipes/tags/convert/">convert</a>, <a href="/recipes/tags/converter/">converter</a>, <a href="/recipes/tags/image/">image</a>, <a href="/recipes/tags/images/">images</a>, <a href="/recipes/tags/pil/">pil</a>). </p> <p>Converts an image from one format to another using PIL.</p> Decimal Number To Byte(s) And String To Byte(s) Converter. (Python) 2012-01-24T21:11:47-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578025-decimal-number-to-bytes-and-string-to-bytes-conver/ <p style="color: grey"> Python recipe 578025 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/bytes/">bytes</a>, <a href="/recipes/tags/converter/">converter</a>, <a href="/recipes/tags/decimal/">decimal</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/string/">string</a>, <a href="/recipes/tags/windows/">windows</a>). </p> <p>A function to convert decimal integer numbers, (from 0 to 255), into byte(s) format. Another function calling the above function to convert ASCII strings into byte(s) format.</p> <p>Python 3.1.3 (r313:86834, Nov 28 2010, 10:01:07) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information.</p> <pre class="prettyprint"><code>&gt;&gt;&gt; exec(open('/home/G0LCU/Desktop/Code/d2b.py').read()) &gt;&gt;&gt; a=78 &gt;&gt;&gt; type(a) &lt;class 'int'&gt; &gt;&gt;&gt; b=d2b(a) &gt;&gt;&gt; print(b) b'N' &gt;&gt;&gt; type(b) &lt;class 'bytes'&gt; &gt;&gt;&gt; text="\x00(C)2012, B.Walker, G0LCU.\xFF" &gt;&gt;&gt; len(text) 27 &gt;&gt;&gt; type(text) &lt;class 'str'&gt; &gt;&gt;&gt; newtext=t2b(text) &gt;&gt;&gt; len(newtext) 27 &gt;&gt;&gt; print(newtext) b'\x00(C)2012, B.Walker, G0LCU.\xff' &gt;&gt;&gt; type(newtext) &lt;class 'bytes'&gt; </code></pre> <p>It requires NOTHING special at all to work and can be run like above or imported from the correct "Lib" drawer/folder/directorfy as:-</p> <pre class="prettyprint"><code>&gt;&gt;&gt; import d2b </code></pre> <p>And when imported called as:-</p> <pre class="prettyprint"><code>&gt;&gt;&gt; d2b.d2b(some_number, optional_some_other_mumber)&lt;RETURN/ENTER&gt; </code></pre> <p>OR</p> <pre class="prettyprint"><code>&gt;&gt;&gt; d2b.t2b(some_ASCII_string)&lt;RETURN/ENTER&gt; </code></pre> <p>Read the code for much more information...</p> <p>Issued under the GPL2 licence.</p> <p>Enjoy finding simple solutions to often very difficult problems.</p> <p>Bazza, G0LCU.</p> Spoken Word to Number (Python) 2012-09-11T18:42:09-07:00Pushpendrehttp://code.activestate.com/recipes/users/4183526/http://code.activestate.com/recipes/578258-spoken-word-to-number/ <p style="color: grey"> Python recipe 578258 by <a href="/recipes/users/4183526/">Pushpendre</a> (<a href="/recipes/tags/converter/">converter</a>, <a href="/recipes/tags/nlp/">nlp</a>, <a href="/recipes/tags/number/">number</a>, <a href="/recipes/tags/spoken/">spoken</a>). </p> <p>convert number represented the way they are spoken to actual numbers</p> Convert a youtube transcript in srt subtitle (Python) 2010-11-12T01:59:53-08:00Ginkohttp://code.activestate.com/recipes/users/4175855/http://code.activestate.com/recipes/577459-convert-a-youtube-transcript-in-srt-subtitle/ <p style="color: grey"> Python recipe 577459 by <a href="/recipes/users/4175855/">Ginko</a> (<a href="/recipes/tags/converter/">converter</a>, <a href="/recipes/tags/srt/">srt</a>, <a href="/recipes/tags/transcript/">transcript</a>, <a href="/recipes/tags/youtube/">youtube</a>). </p> <p>A quick and dirty script to convert youtube's transcripts (xml format) to .srt subtitle files.</p> <p>To download youtube's transcript, use this url: <a href="http://video.google.com/timedtext?lang=en&amp;v=VIDEO_ID" rel="nofollow">http://video.google.com/timedtext?lang=en&amp;v=VIDEO_ID</a> (replace "VIDEO_ID" by the ID which is in the video URL).</p> <p>You can easily use this converter in a script which could download the transcript by importing it and then call the main function.</p> Convert XML into JSON (Python dicts and lists structure) (Python) 2011-08-22T13:30:33-07:00Nikolahttp://code.activestate.com/recipes/users/4176190/http://code.activestate.com/recipes/577494-convert-xml-into-json-python-dicts-and-lists-struc/ <p style="color: grey"> Python recipe 577494 by <a href="/recipes/users/4176190/">Nikola</a> (<a href="/recipes/tags/converter/">converter</a>, <a href="/recipes/tags/json/">json</a>, <a href="/recipes/tags/xml/">xml</a>). Revision 2. </p> <p>There are many ways to convert a specific XML dialect into JSON for easier consumption by Javascript code. This recipe works for some XML-based data, where the format is not really a document and html tags are used as field placeholders. You can use it as-is, but it is intended to serve as a starting point where you can plug your specific needs.</p> iter_except -- a useful variant of __builtin__.iter() (Python) 2010-03-27T02:04:22-07:00Raymond Hettingerhttp://code.activestate.com/recipes/users/178123/http://code.activestate.com/recipes/577155-iter_except-a-useful-variant-of-__builtin__iter/ <p style="color: grey"> Python recipe 577155 by <a href="/recipes/users/178123/">Raymond Hettinger</a> (<a href="/recipes/tags/converter/">converter</a>, <a href="/recipes/tags/iterator/">iterator</a>, <a href="/recipes/tags/wrapper/">wrapper</a>). </p> <p>Variant of iter(func, sentinel) that looks for an exception rather than for a sentinel value. Good for making iterators from of APIs that advance over a data and return an exception when they are done.</p> Convert Trac wiki markup to HTML (Python) 2010-03-09T08:02:36-08:00ccpizzahttp://code.activestate.com/recipes/users/4170754/http://code.activestate.com/recipes/577094-convert-trac-wiki-markup-to-html/ <p style="color: grey"> Python recipe 577094 by <a href="/recipes/users/4170754/">ccpizza</a> (<a href="/recipes/tags/converter/">converter</a>, <a href="/recipes/tags/trac/">trac</a>). </p> <p>Convert trac wiki markup to HTML Usage: %s &lt;inputfile.wiki&gt; [outputfile.html] If outputfile.html is missing output is redirected to stdout in utf8 encoding.</p>