Articles tagged with python

  1. [Python] Popular Search Terms

    Posted on in programming

    I thought it would be neat to keep an eye on the popular google search terms related to Python.

    The list below uses JavaScript from Google Trends. You can use the kebab menu icon to choose between "Top" and "Rising" search phrases.

  2. [Python] Socket Timeouts in urllib2

    Posted on in Programming

    Things have changed quite a lot since this post was originally written in 2016. Currently, I would recommend switching over to making asynchronous calls via aiohttp.

    One of my scripts that makes an API call has been failing silently lately. It appears that the connection is timing out, but I …

  3. Geeky Goals for 2016

    Posted on in uncategorized

    The new year is finally upon us. Traditionally, I have not been one to make New Year's Resolutions. This year, I decided that rather than a list of resolutions, I would create a list of goals. These are things I would like to achieve over the next year. In other …

  4. UnicodeDecodeError: 'ascii' codec can't decode byte

    Posted on in Programming

    Although I was getting this output in relation to one of my Jinja2 templates, it really isn't a Jinja2 problem.

    UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 69: ordinal not in range(128)
    

    The bit of code here should be doing nothing more than printing a float …

  5. [Python] Empty String?

    Posted on in Programming

    I've mentioned before that empty strings in Python are false. This leads to a common if not string paradigm. Unfortunately, this can be problematic. Check out this snippet:

    >>> string = ""
    >>> if not string:
    ...  print("empty")
    ... 
    empty
    

    That pretty much worked out just as we imagined. The empty string returned False and …

  6. Using Pelican's article.summary

    Posted on in Programming

    I'm using Jinja2 templates with my new Pelican-based articles. If you have Django experience, you'll feel right at home using Jinja2 templates. I decided early on that I wanted to create my own theme from scratch and keep it as basic as possible. (In fact, 'basic' is the name …

  7. Getting Started With Pelican

    Posted on in Software

    I've been using WordPress on this site since 2007. After all this time, I've decided I want to try something new. So, I've decided to go in a completely different direction and start serving static content. There are three things driving my decision to change:

    • The existing site is really …
  8. [Python] Convert String Date to Date Object

    Posted on in Programming

    Occasionally, you may run across a date in a format that can't be easily loaded into a Python date object. For example, I recently had a situation where a file I was parsing was full of dates in this format: 7/7/2008.

    The obvious thing to do here is …

  9. Empty Strings in Python Are False

    Posted on in Programming

    Recently I was working on some old code. One of my model methods was originally written such that if one parameter was set to the Python None type, a particular set of actions would occur. For some reason, I checked for None like this:

    if parameter is None:
        do something …

Slaptijack's Koding Kraken