Share →

I’ve heard Python is “wrist-friendly”.  It is!  So, basically I needed to create a quick application to merge some text files into an HTML template to update a web site with new content easily.  (Yes, I’ve heard of dynamic web sites… but didn’t need anything but relatively static pages.)  So, I tried to do it in Excel, and I figured that would be pretty straightforward, but Excel 2007 is WAY too good at “reformatting” HTML text, and so it always “corrected” what I wanted to do.  So, I figured, why not give Python a shot.  Granted, it took me longer to write than if I’d done it in C# or Ruby, but how else does one learn…

After a few minutes of downloading ActiveState’s Python, I fired it up, and had a tool to read through a directory, picking out all the .content files and merging them with my HTML template.  It took me a while to get familiar with the feeling of the language, but a few minutes later, I had it up and running.  It only takes about a quarter second to create the 15 web pages.  As far as wrist friendly goes, it took about 8 lines of code.  Not bad.  So, I figured I’d go the next step, and FTP the files to the web site.  At another 6 lines of code, I had it uploading to the site via FTP.  Total time in: less than 2 hours.  Maybe I could have done it in C# faster, but this was quite the ride.

But I’m addicted to the .NET Framework, so…  next stop:  IronPython!

UPDATE: Those who know me, know I’m a big fan of the Ruby language.  But IronRuby has taken so long to “bake” and IronPython is nearly hitting their 2.0 release.  So…  off to Python, for a try!

Print Friendly
Tagged with →