Popular Python recipes tagged "sys"http://code.activestate.com/recipes/langs/python/tags/sys/2015-09-30T15:12:17-07:00ActiveState Code RecipesConvert JSON to PDF with Python and xtopdf (Python)
2014-12-10T18:02:14-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/578979-convert-json-to-pdf-with-python-and-xtopdf/
<p style="color: grey">
Python
recipe 578979
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/json/">json</a>, <a href="/recipes/tags/pdfwriter/">pdfwriter</a>, <a href="/recipes/tags/sys/">sys</a>).
</p>
<p>This recipe show the basic steps needed to convert JSON input to PDF output, using Python and xtopdf, a PDF creation toolkit. xtopdf is itself written in Pytho, and uses the ReportLab toolkit internally.</p>
<p>We set up some needed values, such as the output PDF file name, the font name and size, the header and footer, and the input lines for the body of the PDF output; all these values are passed in JSON format (in a single dictionary) to a function that uses those values to generate a PDF file with the desired content.</p>
<p>The code is intentionally kept simple so as to require the least amount of code needed to demonstrate the techniques involved. But it can be generalized or extended to more complex situations.</p>
How a Python function can find the name of its caller (Python)
2015-09-30T15:12:17-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/579105-how-a-python-function-can-find-the-name-of-its-cal/
<p style="color: grey">
Python
recipe 579105
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/evaluation/">evaluation</a>, <a href="/recipes/tags/introspection/">introspection</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/sys/">sys</a>).
</p>
<p>This recipe shows how a Python function can find out the name of its caller, i.e. which other Python function has called it.</p>
make some file named year+month+day (Python)
2012-02-10T23:46:36-08:00ryotaro gotohttp://code.activestate.com/recipes/users/4180840/http://code.activestate.com/recipes/578036-make-some-file-named-yearmonthday/
<p style="color: grey">
Python
recipe 578036
by <a href="/recipes/users/4180840/">ryotaro goto</a>
(<a href="/recipes/tags/beginner/">beginner</a>, <a href="/recipes/tags/date/">date</a>, <a href="/recipes/tags/file/">file</a>, <a href="/recipes/tags/sys/">sys</a>).
Revision 6.
</p>
<p>This program make some file named year+month+day
How to use "python program argument
example:argument=01,02,...,12
If you input 02,it will return files named
20120201,...,20120228</p>