Don't know if this could be useful to anyone else, but I just wrote a wee script that generates the HTML for images in a directory on my web server, to make it easier to post about them to my journal:
( Example of running it: )
import Image, sys
if len(sys.argv) < 3:
print "Usage: %s [baseurl] [filename] [filename] ..." % sys.argv[0]
# put this in front of each image file name
baseurl = sys.argv[1]
# cycle through all image names given on the command line
for imagefile in sys.argv[2:]:
try:
i = Image.open(imagefile)
( width, height ) = i.size
print '<img src="%s/%s" width="%d" height="%d" alt="" />' \
% ( baseurl, imagefile, width, height )
except IOError:
print "Could not process %s" % imagefile
( Example of running it: )
.vimrc specifically for Python
Aug. 12th, 2010 10:53 amApparently, Python has a .vimrc file (which specifies how the command-line vim editor works) specifically for coding in the recommended Python style:
http://svn.python.org/projects/python/tr
I put it as .vimrc-python and included it in my main .vimrc like so:
source ~/.vimrc-python
Dear python shell:
Apr. 23rd, 2010 02:34 pmMost of the time when I want to quit using you, I do something like this:
I am not sure why, if you know enough about what I want to give me a warning message about what I should Properly Do, you couldn't just exit and save me the headdesking trouble!
Other than that, I love you, so I am hoping you have a Really Good reason for this that I just don't know about.
>>> exit Use exit() or Ctrl-D (i.e. EOF) to exit
I am not sure why, if you know enough about what I want to give me a warning message about what I should Properly Do, you couldn't just exit and save me the headdesking trouble!
Other than that, I love you, so I am hoping you have a Really Good reason for this that I just don't know about.
Code like a Pythonista: Idiomatic Python
Sep. 17th, 2009 10:23 amI kind of wish I had this article when I was first embarking on Python, but it's still useful to me even later in the game:
Code Like a Pythonista: Idiomatic Python
Code Like a Pythonista: Idiomatic Python
Subclassing a dictionary
Sep. 15th, 2009 12:02 pmMakes me love Python. I needed an class for a test suite for the DWMinion module I'm making to make it easy to create DWAccount objects on the fly. I figured out that I could do this by subclassing the dict class.
( Code here )
( Code here )
Python icons based on XKCD
Aug. 20th, 2009 10:23 amI love XKCD
I especially love http://xkcd.com/353/
So I made three icons, which you are free to use.
and 
And animated version of that comic might be even better, maybe I'll do that later.
I especially love http://xkcd.com/353/
So I made three icons, which you are free to use.
And animated version of that comic might be even better, maybe I'll do that later.
Hey, everyone. I just posted a roll call for women in python over here, because I'm curious whether there just aren't a lot of women using python, or if the ones who are are just pretty quiet about it, and not very involved with the larger python community. I think those are both important issues, but they're very different ones.
Could you help me spread the word? And, of course, raise your hand if you're a woman! Thanks in advance.
Could you help me spread the word? And, of course, raise your hand if you're a woman! Thanks in advance.
If you're interested in doing web development in Python, their wiki has a list of frameworks.
The Python web framework I've been developing in lately called Django, and I just made a community for it at
django_dev.
The Python web framework I've been developing in lately called Django, and I just made a community for it at