Any day you learn something new is a good day

Playing with Python

, posted: 24-Oct-2012 22:07

For the last few years I've had a hankering to learn another programming language, and since I've had a little bit of time over the last couple of weeks free I've been playing with Python.

First impression - wow, what a productive tool.

During my life I've learned Basic (on the Vic20 & C64 continuing into GW Basic and the like on Dos/Windows, then Pascal, then C, then Visual Basic.  I ended up settling on KIX (a Microsoft written scripting language) that did pretty much everything I needed to write little tools that did stuff quick & dirty.

Well, now that I've dived into Python I'm sorry KIX, but your days are over as my general purpose go-to-language.

The kind of tools I usually need to write these days are ones that either a) take some config from an .INI file and do stuff at a regular time, or b) parse output file(s) from something else and do stuff with them so that other things can be done. KIX was OK at both of these - native .INI support, Windows registry support & AD aware made it a great general purpose language to know (yes, I know PowerShell can do all this and more, but PowerShell's not the easiest thing to find good & easy to follow documentation for learning on).

Python however has all the goodness of KIX + a huge library of well documented & easy to use functions that are far more productive than anything I've used previously.  The string handling functions alone are amazing.  And since has a great tutorial to follow through for learning I got running immediately.

So far it's been a week and a half since I first started in Python and I've got two file processing tools & one fully fledged GUI app up and running in production.

One tool takes a *huge* .csv that's spat out of one of our systems that contains information that I need to separate out into a big bunch of individual files - but the .csv isn't continuous.  It's got lot of different sections separated by line feeds.

Parsing this file in KIX took about 100 lines of code to do what I needed, and took me a week to get the logic just right. Doing it in Python takes 11 lines and took me about 30min.  And I didn't even use the same logic I used for KIX - I decided to do it differently.

I recommend Python to anyone who's wondering what to learn next - PHP/Ruby will be next on my list of cross platform languages I think.

Other related posts:
Building A Win8.1 based Chromebook - A How To
OKI B411n & how to reset the NIC
Imaging Edubuntu

Permalink to Playing with Python | Add a comment (1 comment) | Main Index

Comment by nate, on 24-Oct-2012 23:14

Ah PHP - where variable declarations don't matter...

Add a comment

Please note: comments that are inappropriate or promotional in nature will be deleted. E-mail addresses are not displayed, but you must enter a valid e-mail address to confirm your comments.

Are you a registered Geekzone user? Login to have the fields below automatically filled in for you and to enable links in comments. If you have (or qualify to have) a Geekzone Blog then your comment will be automatically confirmed and shown in this blog post.

Your name:

Your e-mail:

Your webpage:

nzsouthernman's profile

New Zealand

This blog is mainly going to be for writing down things when I work them out so when I have to try and do it again I don't have to think too hard.  And also to comment on stuff.  Hopefully not too much rant /rant involved.

My latest finished and successful home project;

FreeNAS NAS/SAN Appliance
Celeron 2.8ghz CPU, 1GB RAM, 4x 1TB SATA drives in RAID-5 array, booting from 1GB USB flash drive

Toys in the attic;
Nokia E71-3 (Telecom XT)
iPhone 3GS (Vodafone)
MythTV separated backend with 2 DVB-S encoders & 1.2TB disk space & two frontends

Follow me on twitter;