Posts where I used the Python programming language and thought that was interesting.

tags → python


  • Circular Grids With Python and Pillow

    Circular Grids With Python and Pillow

    Jan 23, 2019

    Programming · python ·

    I want a circular grid for drawing. Let's make one with Python!

  • Drawing Grids With Python and Pillow

    Drawing Grids With Python and Pillow

    Nov 24, 2017

    Programming · python ·

    Hey I used Python and Pillow to make grids for my drawing. Read on to watch my brain while I figured it out. Apologies for the minimal editing and the ridiculous number of images.

  • Backing The Flask Mega Tutorial Kickstarter

    Jul 9, 2017

    Marginalia · python ·

    Miguel Grenbergs’ Flask Mega-Tutorial and book helped me understand using Python’s Flask microframework. Well, somewhat. My understanding would improve if I used it more. Haven’t taken advantage of the opportunity yet. Anyways - of course I decided to back his Kickstarter for updating the Flask Mega-Tutorial.

  • All The Hugo Themes

    All The Hugo Themes

    Jan 2, 2016 (Updated Jan 4, 2016)

    Programming · hugo · python ·

    My site does well enough with Hugo and a custom theme, but I wanted to explore the themes repository. So I wrote some Python.

  • Python3 and pyvenv

    Jul 4, 2014

    Tools · python ·

    I have been spending much of my coding time in Python recently. This site is built in Pelican. Many lines of Python have been written for work. I have even been poking at Google App Engine in what spare time is available. The only disappointment is that all of these have been in Python 2. I would prefer to be using Python 3. There is a little free time today, so I will set up a nice Python 3 workspace.

  • Python 2 Babysteps 01 Installing Python 2

    Jun 16, 2011 (Updated Jun 21, 2011)

    Coolnamehere · python · learn ·

    Think of this as Step Zero for the other Python tutorials out there.

  • IPython

    Jun 10, 2011

    Coolnamehere · python ·

    $ sudo apt-get install ipython $ sudo port install py27-ipython $ alias ipython='ipython-2.7' $ ipython Python 2.7.1 (r271:86832, May 18 2011, 11:05:32) Type "copyright", "credits" or "license" for more information. IPython 0.10.1 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object'. ?object also works, ?? prints more. In [1]: exit() Do you really want to exit ([y]/n)?
  • Python 2.x Babysteps

    Jun 7, 2011 (Updated Jun 16, 2011)

    Coolnamehere · python · learn2x ·

    Introduction If you have never programmed before in your life, then do I have the perfect programming language for you. It’s called Python. It is easy to learn, flexible, and loaded with capabilities that you never thought would be so easy to use. Imagine your thrill when you write a complete program in just a few lines! If you have spent years programming Perl, and are just about sick of all of the weird little context dependencies (“My function does this when you hand it a single object, and that when you hand it a list, unless you are assigning the result to a list, in which case it does this other thing”), then do I have the perfect language for you.
  • Elaborate Answers To Simple Questions

    Apr 14, 2011

    Blogspot · python ·

    tl;dr: Use string methods instead of importing string. Build email messages with the standard email library.

  • Python Blogger Refresh Part 2 - Settings

    Jun 12, 2009

    Blogspot · blogger · gdata · python ·

    The Idea

    I had to focus my efforts last time on restoring the original functionality of my Python Blogger script. That’s out of the way. I can now start looking at enhancements. The first annoyance - of many - is the fact that Blogger connection settings are hard-coded into the script. Do you want to post to a different blog? That’s going to require editing the source.

  • Python Blogger Refresh, Part 1

    Jun 9, 2009 (Updated Jun 12, 2009)

    Blogspot · blogger · gdata · markdown · python ·

    The Idea

    I wrote a post a while back about using Python to write Blogspot posts from the command line. It took me about two weeks to completely forget about it. Still, it’s one of the few posts on this blog that gets regular visits, and the code … well, the code is not great. It was a fair effort, but it didn’t even accomplish the things I had initially set out to do. Account information is hard-coded into the code, for example. I also blundered along haphazardly with parsing metadata information myself despite the fact that Python Markdown has an extension which is perfectly capable of handling metadata. Well, let’s look at that code again.

  • Adding Categories to the Python Blogger Client

    Jan 2, 2008

    Blogspot · blogger · gdata · python ·

    Update 2009-06-09

    I’ve revisited the code for Blogger posting with Python. Start with the Python Blogger refresh to see the new starting point.

  • Python Loves Blogger (Part 1)

    Dec 28, 2007 (Updated Mar 28, 2015)

    Blogspot · blogger · python ·

    I’ve revisited the code for Blogger posting with Python. Start here to see the new starting point.

  • Python Interactive Fiction - 03 Handling Multiple Turns

    Jun 14, 2007 (Updated Jul 11, 2009)

    Coolnamehere · python · ifiction · learn ·

    This is Part 3 of an ongoing series about writing interactive fiction games in Python. By the end of Part 2 we had created a text-based user interface and explored one way of storing multiple scenes. This part will finally bring the needed glue for the player to move between all of the scenes in the story. In other words, we’ll have a game!

  • Python Interactive Fiction - 02 Tying the Scenes Together

    Apr 20, 2007 (Updated Jul 11, 2009)

    Coolnamehere · python · ifiction · learn ·

    This is the second part of an ongoing series about using Python to create interactive fiction. I hope to show you one fun use of Python while teaching you more about the basics of this language. We started by defining how our game was going to work and creating a set of scenes for play. Next we wrote the code to handle a single round of the game. Today we are going to tie all of our scenes together to make a complete, playable game of interactive fiction. We are going to approach it from an experimental view, playing with different approaches until we find one that makes us happy. Well, one that makes me happy.

  • Python Interactive Fiction - 01 Handling a Single Round

    Apr 19, 2007 (Updated Jul 11, 2009)

    Coolnamehere · python · ifiction · learn ·

    I think the next step is to write the code for a single round of the game. We’ll limit ourselves to Scene 1 to stay focussed.

  • Interactive Fiction with Python

    Apr 18, 2007 (Updated Jul 11, 2009)

    Coolnamehere · python · ifiction · learn ·

    The idea for this article came from a coolnamehere reader named Laura. Thanks, Laura! I was looking for good Python ideas.

  • Control Structures

    Jul 11, 2004 (Updated Jul 11, 2004)

    Coolnamehere · python · learn ·

    There are several different approaches to programming, but the one that is easiest for me to grasp is imperative programming. The imperative approach allows you to tell the computer exactly what you want it to do and how you want it done. The best analogy I can think of is a cooking recipe. You have a list of ingredients and a specific set of instructions to follow. Veer from the recipe and you may not be happy with the results. Veer too far from the recipe and your house could burn down.

  • Simple Types in Python

    Jun 12, 2002 (Updated Jul 11, 2009)

    Coolnamehere · python · learn ·

    Ok, it’s been over a year since the first step of my Python Babysteps Tutorial. It’s about time to dig a little deeper.

  • Python

    Jan 17, 2001 (Updated Jul 11, 2009)

    Coolnamehere · python ·

    You may have already heard me say that I do not have a favorite programming language. That’s true. However, if you want to learn how to program - if you have never programmed before in your life (except maybe some QBASIC several years ago) - than Python sticks out way way ahead of the others. It is easy to get started, it is consistent across most operating systems, and you can make your programs as big, elaborate, and “real-world” as you want.
  • Python Babysteps Tutorial

    Jan 17, 2001 (Updated Apr 9, 2017)

    Coolnamehere · python · learn ·

    This is my original Python Babysteps tutorial, which has existed in more or less the same form since 2001. I’ve finally committed to writing a better version