Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

Wednesday, April 09, 2008

Useless?

Just found this website while looking around resources for python. It's pretty funny, and kind of useful in my opinion! Check it out useless python

Python

ahh so I've gotten lazy in updating this blog, but nvm I can start again!

Regarding Django, I've found it relatively easy to use. And of course, once one gets the hang of it, it is easier, but when you are just starting to learn it, the learning curve can take a while. Perhaps it is because I was also not familiar with python then.

For work reasons, I have to be familiar with python now, so anyway I helped a friend out to parse some stuff out from the web. Had intended to use perl as I really like perl's regex, but thought I might as well try python to finally know how to use it :p Anyway, I found this neat little tool pyparsing and also learnt more about python's regex.

I still prefer perl's regex..... or maybe cos I've been using it for so long so I'm biased. But anyway nvm, I need to learn to like python... for a few months at least hahaha

Friday, October 05, 2007

Bulk resize with python

Recently I had to pick up python for a project. So as usual, it is easier and more fun for me to learn something if there is a purpose! So this time, since I'd been messing around with a new camera, I wanted to have something to bulk resize my pics. So I decided to write a script for it. And so here it is!
import Image, os

def make_smaller(path):
for item in os.listdir(path):
try:
image = Image.open(item)
image.thumbnail((583,389), Image.ANTIALIAS)
print 'Resizing: '+item
image.save('small/'+item)
except IOError: None

make_smaller('/home/widdlepuke/Desktop/Python module installers/test')

Very simple, and I must say, I do kinda like python now. I still like my perl though :p I am also currently messing with the Django framework. More on that next time.