The other day I was asked if there was a way to sort a dictionary by value. If you use Python regularly, then you know that the dictionary data structure is by definition an unsorted mapping type. Some would define a dict as a hash table. Regardless, I needed a way to sort a nested […]
There are several cool ways to create PDFs with Python. In this article we will be focusing on a cool little tool called rst2pdf, which takes a text file that contains Restructured Text and converts it to a PDF. The rst2pdf package requires Reportlab to function. This won't be a tutorial on Restructured Text, although […]
I didn't think I'd do one of these link roundups this week, but I decided to go for it anyway. In fact, I found a cool little tool for obtaining information about installed Python packages and querying packages available on PyPI (Python Package Index) called yolk too! Anyway, here's this week's reading list. I hope […]
There are several code analysis tools for Python. The most well known is pylint. Then there's pychecker and now we're moving on to pyflakes. The pyflakes project is a part of something known as the Divmod Project. Pyflakes doesn't actually execute the code it checks, unlike pychecker. Of course, pylint also doesn't execute the code. […]
Python code analysis can be a heavy subject, but it can be very helpful in making your programs better. There are several Python code analyzers that you can use to check your code and see if they conform to standards. pylint is probably the most popular. It's very configurable, customizable and pluggable too. It also […]
Today we'll spend some time looking at three different ways to make Python submit a web form. In this case, we will be doing a web search with duckduckgo.com searching on the term "python" and saving the result as an HTML file. We will use Python's included urllib modules and two 3rd party packages: requests […]