Popular recipes tagged "meta:loc=60"http://code.activestate.com/recipes/tags/meta:loc=60/2015-07-29T18:28:25-07:00ActiveState Code RecipesPython script to login to a website and convert required html page to pdf (Python)
2015-07-29T18:28:25-07:00Emil george jameshttp://code.activestate.com/recipes/users/4191910/http://code.activestate.com/recipes/579081-python-script-to-login-to-a-website-and-convert-re/
<p style="color: grey">
Python
recipe 579081
by <a href="/recipes/users/4191910/">Emil george james</a>
(<a href="/recipes/tags/bs4/">bs4</a>, <a href="/recipes/tags/pyhon/">pyhon</a>, <a href="/recipes/tags/pyqt4/">pyqt4</a>, <a href="/recipes/tags/python_scripts/">python_scripts</a>, <a href="/recipes/tags/urllib2/">urllib2</a>).
</p>
<p>This login script will allow you to login a website with python. After logging in, You now have access to all the pages for “members only” accessed with python and it can convert the required pages to pdf format save automatically in your /home/.</p>
<p>In this script i use anna university official website to get the exam result after that it convert the result page into pdf format and save to /home/.</p>
<p>Modules used :</p>
<ol>
<li><p>urllib2</p></li>
<li><p>BeautifulSoup(bs4)</p></li>
<li><p>requests</p></li>
<li><p>sys</p></li>
<li><p>PyQt4</p></li>
</ol>
<p><a href="https://emilgeorgejames.wordpress.com/2015/07/15/python-script-to-login-to-a-website-and-convert-required-html-page-to-pdf/" rel="nofollow">https://emilgeorgejames.wordpress.com/2015/07/15/python-script-to-login-to-a-website-and-convert-required-html-page-to-pdf/</a></p>
Python AsciiColor and video attributes (Python)
2014-07-24T04:25:53-07:00Mike 'Fuzzy' Partinhttp://code.activestate.com/recipes/users/4179778/http://code.activestate.com/recipes/578908-python-asciicolor-and-video-attributes/
<p style="color: grey">
Python
recipe 578908
by <a href="/recipes/users/4179778/">Mike 'Fuzzy' Partin</a>
(<a href="/recipes/tags/ascii/">ascii</a>, <a href="/recipes/tags/color/">color</a>, <a href="/recipes/tags/dynamic_method/">dynamic_method</a>, <a href="/recipes/tags/metaprogramming/">metaprogramming</a>, <a href="/recipes/tags/python/">python</a>).
Revision 5.
</p>
<p>This is a subclass of a standard str object that adds methods for applying color, and video attributes to text.</p>
Current month calendar (Batch)
2013-10-11T16:11:41-07:00greg zakharovhttp://code.activestate.com/recipes/users/4184115/http://code.activestate.com/recipes/578687-current-month-calendar/
<p style="color: grey">
Batch
recipe 578687
by <a href="/recipes/users/4184115/">greg zakharov</a>
(<a href="/recipes/tags/calendar/">calendar</a>).
</p>
<p>Prints calendar at current month.</p>
kth compsite number (Python)
2013-07-15T14:34:07-07:00Captain DeadBoneshttp://code.activestate.com/recipes/users/4184772/http://code.activestate.com/recipes/578607-kth-compsite-number/
<p style="color: grey">
Python
recipe 578607
by <a href="/recipes/users/4184772/">Captain DeadBones</a>
(<a href="/recipes/tags/kth/">kth</a>, <a href="/recipes/tags/numbers/">numbers</a>, <a href="/recipes/tags/python/">python</a>).
</p>
<p>Found this Interview question. Here is my solution to it.</p>
<p>Assume f(x,y,z) = a^x * b^y * c^z</p>
<p>The x, y and z are integers larger than or equal to zero. Find the kth number in the series this function produces.</p>
<p>Check out my blog <a href="http://thelivingpearl.com/">Captain DeadBones Chronicles</a></p>
Random user generator (Python)
2012-02-27T16:58:33-08:00Koppula Varun Rajhttp://code.activestate.com/recipes/users/4181072/http://code.activestate.com/recipes/578055-random-user-generator/
<p style="color: grey">
Python
recipe 578055
by <a href="/recipes/users/4181072/">Koppula Varun Raj</a>
(<a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/pickle/">pickle</a>, <a href="/recipes/tags/python3/">python3</a>, <a href="/recipes/tags/random/">random</a>).
</p>
<p>I've worked on a random user generator in C a long time ago, so I thought I'd make an advanced version of it in Python(3.2). I'll have you know, I am an amateur in Python and even programming for that matter so I'd really appreciate some criticism on my code and what more can be added.</p>
<p>About the program - I've added a default list of users, you can modify the list to your convenience and for data persistence, I made use of the pickle module. The random module plays the pivotal role generating the output making use of the choice method. Those along with the os module if the program is being run for the first time on a pc, it will create a data file with the default list.After some digging around, I managed to find os.getlogin() from the python library which was exactly what I was looking for (to get the computer's name making sure it can get the data file to the correct directory). I'm a little skeptical about that part, wondering whether or not it will work on every pc.</p>
Fibonacci Number Generator (Python)
2011-04-13T00:00:59-07:00Sunjay Varmahttp://code.activestate.com/recipes/users/4174115/http://code.activestate.com/recipes/577651-fibonacci-number-generator/
<p style="color: grey">
Python
recipe 577651
by <a href="/recipes/users/4174115/">Sunjay Varma</a>
(<a href="/recipes/tags/fibonacci/">fibonacci</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/memorizing/">memorizing</a>, <a href="/recipes/tags/number/">number</a>).
</p>
<p>This recipe allows for individual number generation, and allows for generations of number ranges as well. </p>
<p>The recipe automatically memorizes numbers generated before and keeps them through out the running of the script. This recipe cannot handle too large of numbers, but does act as a simple solution for most cases.</p>
Improved ReportLab recipe for "page x of y" (Python)
2009-07-06T10:03:28-07:00Vinay Sajiphttp://code.activestate.com/recipes/users/4034162/http://code.activestate.com/recipes/576832-improved-reportlab-recipe-for-page-x-of-y/
<p style="color: grey">
Python
recipe 576832
by <a href="/recipes/users/4034162/">Vinay Sajip</a>
(<a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/reportlab/">reportlab</a>).
Revision 2.
</p>
<p>This recipe is based on <a href="http://code.activestate.com/recipes/546511/"><a href="http://code.activestate.com/recipes/546511/">Recipe 546511</a></a> which does not work reliably if there are images in the content.</p>
Alphametics solver (Python)
2010-10-09T00:28:52-07:00Raymond Hettingerhttp://code.activestate.com/recipes/users/178123/http://code.activestate.com/recipes/576615-alphametics-solver/
<p style="color: grey">
Python
recipe 576615
by <a href="/recipes/users/178123/">Raymond Hettinger</a>
.
Revision 9.
</p>
<p>Solves numeric cryptograms listed in Knuth Volume 4 Fascicle 2.</p>
Delete all message older than a given date in a pop account (Python)
2009-10-05T12:56:13-07:00Benjamin Sergeanthttp://code.activestate.com/recipes/users/4039626/http://code.activestate.com/recipes/576922-delete-all-message-older-than-a-given-date-in-a-po/
<p style="color: grey">
Python
recipe 576922
by <a href="/recipes/users/4039626/">Benjamin Sergeant</a>
(<a href="/recipes/tags/delete/">delete</a>, <a href="/recipes/tags/email/">email</a>, <a href="/recipes/tags/pop/">pop</a>).
</p>
<p>I was using the keep option in fetchmail, so I had a huge number of emails that seems to slow down mails retrieval / pop connection. I wanted a way to </p>
Text twister help?? (Python)
2009-11-03T18:14:29-08:00failhttp://code.activestate.com/recipes/users/4172193/http://code.activestate.com/recipes/576947-text-twister-help/
<p style="color: grey">
Python
recipe 576947
by <a href="/recipes/users/4172193/">fail</a>
(<a href="/recipes/tags/text/">text</a>, <a href="/recipes/tags/twister/">twister</a>).
</p>
<p>toast?
ok so im working on a program that takes a randomly generated word
n scrambles all the letters out </p>
<p>then it spits out the letters (which are still scrambled)
it will ask the users to type what they think the word is
they get 10 tries before they lose </p>
<p>the code so far has no bugs in it i just need to know the small piece / block of code
that will scramble the letters in randwrd (this will be seen in the code)</p>
Tail Call Optimization Decorator (Python)
2006-02-26T15:02:54-08:00Crutcher Dunnavanthttp://code.activestate.com/recipes/users/2792865/http://code.activestate.com/recipes/474088-tail-call-optimization-decorator/
<p style="color: grey">
Python
recipe 474088
by <a href="/recipes/users/2792865/">Crutcher Dunnavant</a>
(<a href="/recipes/tags/algorithms/">algorithms</a>).
</p>
<p>This decorator implements tail call optimization through stack introspection.</p>
Calculator of pesticide concentration (Python)
2009-05-08T01:33:59-07:00donyo Ganchevhttp://code.activestate.com/recipes/users/4167704/http://code.activestate.com/recipes/576629-calculator-of-pesticide-concentration/
<p style="color: grey">
Python
recipe 576629
by <a href="/recipes/users/4167704/">donyo Ganchev</a>
.
Revision 2.
</p>
<p>Calculate concentration of pesticides according to active substance</p>
Elegant Tkinter Splash Screen (Python)
2007-10-23T11:38:31-07:00Ronald Longohttp://code.activestate.com/recipes/users/4093058/http://code.activestate.com/recipes/534124-elegant-tkinter-splash-screen/
<p style="color: grey">
Python
recipe 534124
by <a href="/recipes/users/4093058/">Ronald Longo</a>
.
Revision 2.
</p>
<p>This class provides a very simple and clean way to produce a spash screen for any Tkinter application. It requires Python 2.5 or later.</p>
Converts a DOM node object of type element to an ElementTree Element (Python)
2006-10-25T12:09:30-07:00Richard Philipshttp://code.activestate.com/recipes/users/98125/http://code.activestate.com/recipes/498221-converts-a-dom-node-object-of-type-element-to-an-e/
<p style="color: grey">
Python
recipe 498221
by <a href="/recipes/users/98125/">Richard Philips</a>
(<a href="/recipes/tags/xml/">xml</a>).
</p>
<p>DOM2ET is a simple python function which converts a DOM node object of type element to an ElementTree Element.
<br>
Writing it, was a good exercise to understand the workings of ElementTree</p>
exceptional & final: Functional exception handling (Python)
2006-04-23T09:48:32-07:00R Khttp://code.activestate.com/recipes/users/2810477/http://code.activestate.com/recipes/491270-exceptional-final-functional-exception-handling/
<p style="color: grey">
Python
recipe 491270
by <a href="/recipes/users/2810477/">R K</a>
(<a href="/recipes/tags/shortcuts/">shortcuts</a>).
Revision 2.
</p>
<p>Recipe/tool for turning exception handling into functional alternation.</p>
<p>try..except clauses make Python source code often clumsy and impact the readablity. This recipe presents a simple functional approach to work with exceptions and finalizations - applicable in a majority of cases.</p>
History and completion for the python shell (Python)
2006-02-17T18:43:19-08:00Vinko Vrsalovichttp://code.activestate.com/recipes/users/2781993/http://code.activestate.com/recipes/473900-history-and-completion-for-the-python-shell/
<p style="color: grey">
Python
recipe 473900
by <a href="/recipes/users/2781993/">Vinko Vrsalovic</a>
.
</p>
<p>This script creates a history file to share between your interactive python sessions, controlling its size in either lines or bytes. You have to put it in your PYTHONSTARTUP environment variable. As it uses readline, it only works under Unix systems. It also binds the tab key to complete words in the shell</p>
Parameterized database functions (Python)
2006-01-29T00:39:51-08:00Raymond Hettingerhttp://code.activestate.com/recipes/users/178123/http://code.activestate.com/recipes/473803-parameterized-database-functions/
<p style="color: grey">
Python
recipe 473803
by <a href="/recipes/users/178123/">Raymond Hettinger</a>
(<a href="/recipes/tags/database/">database</a>).
</p>
<p>Run parameterized map, filter, reduce, and extract functions on a database structured as a list of tuples. Useful for applications where the filter, extract, and summarize operations are specified by the user at runtime.</p>
Record-Jar Parser (Python)
2005-07-11T06:18:30-07:00Lutz Hornhttp://code.activestate.com/recipes/users/2514543/http://code.activestate.com/recipes/436229-record-jar-parser/
<p style="color: grey">
Python
recipe 436229
by <a href="/recipes/users/2514543/">Lutz Horn</a>
(<a href="/recipes/tags/text/">text</a>).
</p>
<p>A method to parse a file like object containing data in the record jar format as described by ESR in "The Art of Unix Programming" (see <a href="http://www.faqs.org/docs/artu/ch05s02.html#id2906931%29." rel="nofollow">http://www.faqs.org/docs/artu/ch05s02.html#id2906931).</a></p>
Memoize Decorator with Timeout (Python)
2004-11-02T07:16:11-08:00S Whttp://code.activestate.com/recipes/users/1759688/http://code.activestate.com/recipes/325905-memoize-decorator-with-timeout/
<p style="color: grey">
Python
recipe 325905
by <a href="/recipes/users/1759688/">S W</a>
(<a href="/recipes/tags/algorithms/">algorithms</a>).
Revision 5.
</p>
<p>This simple decorator is different to other memoize decorators in that it will only cache results for a period of time. It also provides a simple method of cleaning the cache of old entries via the .collect method. This will help prevent excessive or needless memory consumption.</p>
Marshalling Python Data into Javascript (Python)
2003-05-20T14:56:08-07:00Jacob Smullyanhttp://code.activestate.com/recipes/users/121058/http://code.activestate.com/recipes/200839-marshalling-python-data-into-javascript/
<p style="color: grey">
Python
recipe 200839
by <a href="/recipes/users/121058/">Jacob Smullyan</a>
(<a href="/recipes/tags/web/">web</a>).
</p>
<p>When writing web applications with an application framework like SkunkWeb, it is sometimes desirable to make Python data available to client-side Javascript. This recipe creates a function, to_js, that marshals Python data into a Javascript string.</p>